Re: [PHP-XML-DEV] serializing DomDocument objects.
[email protected] (neill)
| Newsgroups | php.xml.dev |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 26 Sep 2003 11:10:59 +0200, Christian Stocker wrote: > > > On 9/26/03 11:02 AM, Neill Roy wrote: >>> From: Christian Stocker <[email protected]> >>> To: neill <[email protected]> >>> CC: [email protected] >>> Subject: Re: [PHP-XML-DEV] serializing DomDocument objects. >>> Date: Fri, 26 Sep 2003 10:00:49 +0200 >>> >>> >>> >>> 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 a whole DomDocument _object_ using the >> serialize() function. something like: >> $domDoc = new DomDocument() >> $domDoc->load('foo.xml') >> file_put_contents('file', serialize($domDoc)) > > which is almost the same as > > $domDoc = new DomDocument() > $domDoc->load('foo.xml') > file_put_contents('file', $domDoc->saveXML()) but wouldn't $domDoc = unserialize(file_get_contents('file')) be faster than doing $domDoc = new DomDocument() $domDoc->load('foo.xml') ? i only thought that this would be the case after reading an article about the DOM (on devshed i think) that said that one of the downsides of the DOM was that a tree structure (?) of the xml document needs to be created, and the process of making the tree can be resource intensive. obviously, correct me if i'm wrong :) riot.