Serializing SimpleXML objects?
[email protected] (Philip Fletcher) Fri, 05 Mar 2004 14:26:04 +0000
| Newsgroups | php.xml.dev |
|---|---|
| Organization | Stutchbury |
| Message-ID | <[email protected]> |
From the following code snippet, it obviously is, but is it possible to use them once they're unserialized? $xml = '<entity1 name="fred">Some Text<entity2 name="bert" /></entity1>'; $sxml = simplexml_load_string($xml); echo htmlspecialchars($sxml->asXML()); $ser_xml = serialize($sxml); //Raises Warning: Node no longer exists in... (twice) $unser_xml = unserialize($ser_xml); //Raises Warning: Node no longer exists in... (twice) echo htmlspecialchars($unser_xml->asXML()); 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) Regards Philip