simplexml and dom
| From: | Greg Beaver | Date: | Tue, 07 Sep 2004 17:27:49 +0000 |
| Subject: | simplexml and dom | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-12632@lists.php.net to get a copy of this message | ||
Hi,
I've been experimenting with using both simplexml and dom on the same document at the same time, and have run into a number of unexplainable PHP crashes unless I clone the domdocument object before using simplexml_import_dom()
Is it a design goal of simplexml to be able to use it simultaneously with dom, or is it important to use either a simplexmlelement or a domdocument for the same structure but not both? If so, I will add a note to the manual, but I wanted to check with the creators first.
A simplified version of the code I use is something like:
<?php
$blah = 'xml stuff'; // this is actually the contents of a package.xml extracted from disk
$d = new DOMDocument;
$d->loadXml($blah); // I do error checking here
$sx = simplexml_import_dom($d);
// manipulate document structure using dom
// retrieve values using simplexml for simple tags
?>
Thanks,
Greg