Re: serializing DomDocument objects.
| From: | Eric Daspet | Date: | Thu, 02 Oct 2003 13:16:28 +0000 |
| Subject: | Re: serializing DomDocument objects. | ||
| References: | 1 2 | Groups: | php.xml.dev |
| Request: | Send a blank email to php-xml-dev+get-221@lists.php.net to get a copy of this message | ||
Le Fri, 26 Sep 2003 10:00:49 +0200, Christian Stocker a écrit :
>> Hi all. I was just wondering why my attempts to serialize DomDocument
>> objects have failed? Is this a bug, or am I doing something wrong?
>
> what does serializing exactly mean for you?
>
> $serializedxml = $domdocument->saveXML();
>
> should serialize it to a string.
>> I am also unable to save DomDocument's in session variables (not that I
>> want to do that or anything, just testing). I get "Warning: Couldn't fetch
>> domdocument in..." when i try to use the object after storing it.
>
> not possible, never will be possible (AFAIK).
Couldn't we make some magic there ?
ie use __sleep() and __wake() to saveXML() when someone put the object in
session and reload it when the session is reopened ?
We'll lose all references so it can not be used to store many object
references to places in the same document, but it will be better than
nothing
There will also be no gain in speed but in doing that someone will be able
to store everything in session without handling all objects differently.
--
Eric Daspet