Re: [PHP-XML-DEV] serializing DomDocument objects.

[email protected] ("Eric Daspet")
Newsgroups php.xml.dev
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.