[PHP] Re: Working with XML: DomDocument or SimpleXML?

2007-09-21 Thread Rob
Colin Guthrie wrote: snip / I know I definitely want to do XSLT stuff and for that I need to use DomDocument (I'm sure there are other ways but this works fine for me so far!). Fairly unknown tidbit: you can pass SimpleXML objects to the XSL extension. XSL will use the document from it.

[PHP] Re: Working with XML: DomDocument or SimpleXML?

2007-09-21 Thread Colin Guthrie
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 =

[PHP] Re: Working with XML: DomDocument or SimpleXML?

2007-09-21 Thread Colin Guthrie
Rob wrote: 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. I think I just didn't do the -ownerDocument or

[PHP] Re: Working with XML: DomDocument or SimpleXML?

2007-09-21 Thread Rob
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

[PHP] Re: Working with XML: DomDocument or SimpleXML?

2007-09-20 Thread Colin Guthrie
Robert Cummings wrote: I still use PHP4 so I wrote my own XML handling class that wraps the xml_xxx() series of functions. Haven't had a problem with it. Makes working with XML very easy since it uses a path string syntax to focus/access nodes and attributes: Cheers for that. I know I