Re: Serializing SimpleXML objects?
| From: | Adam Trachtenberg | Date: | Fri, 05 Mar 2004 14:39:14 +0000 |
| Subject: | Re: Serializing SimpleXML objects? | ||
| References: | 1 | Groups: | php.xml.dev |
| Request: | Send a blank email to php-xml-dev+get-348@lists.php.net to get a copy of this message | ||
On Mar 5, 2004, at 9:26 AM, Philip Fletcher wrote:
No. Don't do this. :)From the following code snippet, it obviously is, but is it possible to usethem once they're unserialized? $ser_xml = serialize($sxml); //Raises Warning: Node no longer exists in... (twice)
This may seem a strange requirement, but I'm attempting to see if deserializing has better performance than simplexml_load_file(). (I'm cacheing portions of a potentially large xml file, so I don't have to load the whole file for every request)The performance is better, but the results are worse because PHP doesn't actually serialize out the document. :) It doesn't always make sense to cache a fragment of an XML file because you may screw up your namespaces; however, if that's okay, cut it up using asXML() instead. -adam -- adam trachtenberg adam@trachtenberg.com