SimpleXML's asXML() method always returns the entire document
regardless of the node. I believe (Sterling?) we decided the correct
behavior here is to only return the XML data for the current node and
its children.
A patch to fix the behavior is available here:
http://www.trachtenberg.com/patches/simplexml_asXML_patch.txt
Note that with this patch, calling asXML() on an attribute will return
just the attribute and its value, not the element where the attribute
is located. For example: foo="bar" instead of <element foo="bar"/>. I
think this makes sense, but it's probably easy to change.
-adam
--
adam@trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!
Change committed - thanks.
-Sterling
SimpleXML's asXML() method always returns the entire document
regardless of the node. I believe (Sterling?) we decided the correct
behavior here is to only return the XML data for the current node and
its children.A patch to fix the behavior is available here:
http://www.trachtenberg.com/patches/simplexml_asXML_patch.txt
Note that with this patch, calling asXML() on an attribute will return
just the attribute and its value, not the element where the attribute
is located. For example: foo="bar" instead of <element foo="bar"/>. I
think this makes sense, but it's probably easy to change.-adam
--
adam@trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!--
--
"Reductionists like to take things apart. The rest of us are
just trying to get it together."
- Larry Wall, Programming Perl, 3rd Edition