Rob wrote:
> Fairly unknown tidbit: you can pass SimpleXML objects to the XSL
> extension. XSL will use the document from it.

Nice to know... /me will have to experiment!

>>     if ($xml instanceof SimpleXMLElement)
>>     {
>>       $rv = new DOMDocument('1.0', 'utf-8');
>>       $node = dom_import_simplexml($xml);
>>       $node = $rv->importNode($node, true);
>>       $rv->appendChild($node);
>>       return $rv;
>>     }
> 
> Why??? If you really want a DOMDocument object why are you creating a
> new document, copying nodes and incurring all the additional overhead?
> 
> 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.....).

Col

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

Reply via email to