Re: [PHP-XML-DEV] Serializing SimpleXML objects?
[email protected] (Adam Trachtenberg) Fri, 5 Mar 2004 09:39:14 -0500
| Newsgroups | php.xml.dev |
|---|---|
| Message-ID | <[email protected]> |
On Mar 5, 2004, at 9:26 AM, Philip Fletcher wrote: >> From the following code snippet, it obviously is, but is it possible >> to use > them once they're unserialized? > > $ser_xml = serialize($sxml); > > //Raises Warning: Node no longer exists in... (twice) No. Don't do this. :) > 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 [email protected]