public function toXML(Builder $query)
    {
        $root = with($dom = new DOMDocument())->createElement('root');

        foreach ($this->each($query) as $object) {
            $item = $dom->createElement('item');

            foreach ($this->toScalar($object) as $column => $value) {
                $column = $dom->createElement($column, htmlspecialchars($value));
                $item->appendChild($column);
            }

            $root->appendChild($item);
        }

        $dom->appendChild($root);

        file_put_contents(
            $file = $this->getFilename(),
            $dom->saveXML()
        );

        return $this->sendDownloadResponse($file, 'xml', ['Content-Type' => 'text/xml']);
    }