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

[email protected] (Christian Stocker)
Newsgroups php.xml.dev
Message-ID <[email protected]>

On 9/26/03 11:12 AM, neill wrote:

> On Fri, 26 Sep 2003 10:00:49 +0200, Christian Stocker wrote:
> 
> 
>>
>>On 9/26/03 9:52 AM, neill wrote:
>>
>>>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 want to serialize the object, not the XML. I have a couple of XML
> documents that are made into DomDocument objects on each request to my
> framework. I was hoping to serialize these objects using serialize() so
> that I wouldn't have to create the DomDocuments each time. Just
> unserialize() them - which should be a lot faster.

you have a DomDocument with child-elements?

No, it's not possible (even if you don't have Child-elements). libxml2 
has no possibility to "serialize" their internal tree and will not have 
in the soon future.

Therefore the only solution is to use saveXML(). We could (but i don't 
know the details) wrap that around serialize, but it doesn't make much 
sense to me and speed gain would be zero...

chregu
> 
> Maybe I'm not explaining this very well.
> 
> riot.
> 

-- 
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  |  [email protected]  |  gnupg-keyid 0x5CE1DECB
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.