Re: Serializing SimpleXML objects?
| From: | Christian Stocker | Date: | Fri, 05 Mar 2004 14:33:06 +0000 |
| Subject: | Re: Serializing SimpleXML objects? | ||
| References: | 1 | Groups: | php.xml.dev |
| Request: | Send a blank email to php-xml-dev+get-347@lists.php.net to get a copy of this message | ||
On 3/5/04 3:26 PM, Philip Fletcher wrote:
you can't deserialize XML object like you want. This was discussed before: http://news.php.net/article.php?group=php.xml.dev&article=205 chreguFrom the following code snippet, it obviously is, but is it possible to usethem 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-- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid 0x5CE1DECB