public function objectToDom($obj)
    {
        $doc = new DomDocument('1.0', 'utf-8');

        foreach ($obj as $k => &$v) {
            $node = $this->objectToDomElement($v, $doc->createElement($k), $doc);
            break;
        }

        $doc->appendChild($node);

        return $doc;
    }
public function objectToDom($obj)
    {
        $doc = new DomDocument('1.0', 'utf-8');

        foreach ($obj as $k => &$v) {
            $node = $this->objectToDomElement($v, $doc->createElement($k), $doc);
            break;
        }

        $doc->appendChild($node);

        return $doc;
    }
public function objectToDom ( $ obj ) { $ doc = new DomDocument ( '1.0' , 'utf-8' ) ; foreach ( $ obj as $ k => & $ v ) { $ node = $ this -> objectToDomElement ( $ v , $ doc -> createElement ( $ k ) , $ doc ) ; break ; } $ doc -> appendChild ( $ node ) ; return $ doc ; }
Converts PHP object to DomDocument.
Note that only the first element in object is converted as XML
can only have one root element.

@param mixed $obj;

@return DomDocument
Converts PHP object to DomDocument . Note that only the first element in object is converted as XML can only have one root element .