src/Writer.php
public function writeToDom($data, $rootName = 'root')
    {
        $this->buildXML(
            $dom = new DOMDocument('1.0', $this->getEncoding()),
            $root = $dom->createElement($rootName),
            $data
        );
        $dom->appendChild($root);

        return $dom;
    }
public function writeToDom($data, $rootName = 'root')
    {
        $this->buildXML(
            $dom = new DOMDocument('1.0', $this->getEncoding()),
            $root = $dom->createElement($rootName),
            $data
        );
        $dom->appendChild($root);

        return $dom;
    }
public function writeToDom ( $ data , $ rootName = 'root' ) { $ this -> buildXML ( $ dom = new DOMDocument ( '1.0' , $ this -> getEncoding ( ) ) , $ root = $ dom -> createElement ( $ rootName ) , $ data ) ; $ dom -> appendChild ( $ root ) ; return $ dom ; }
Write the input data to a DOMDocument

@param mixed $data
@param string $rootName the xml root element name

@return DOMDocument
Write the input data to a DOMDocument