PATCH: SimpleXML asXML()
| From: | Adam Maccabee Trachtenberg | Date: | Tue, 20 Jan 2004 00:13:38 +0000 |
| Subject: | PATCH: SimpleXML asXML() | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-7195@lists.php.net to get a copy of this message | ||
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!