Re: Working with XML: DomDocument or SimpleXML?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Colin Guthrie wrote:
Rob wrote:

if ($xml instanceof SimpleXMLElement)
{
   /* No copying, just use the existing XML tree directly */
   $node = dom_import_simplexml($xml);
   return $node->ownerDocument;
}

Yeah I had that initially too but that did not produce a DOMDocument
Object but a DOMNode Object (or something like that.... will have to
test again as memory is corrupted - there /was/ a reason, and stupid me
didn't comment the code.....).

It had to have been for some other reason as the return type for the above example is a DOMDocument. A raw DOMNode is *NEVER* returned from the DOM extension. It is simply a base class for most of the DOM classes, such as DOMDocument.

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux