Re: Is really no one interested?

From: Date: Tue, 01 Nov 2005 07:48:13 +0000
Subject: Re: Is really no one interested?
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-19871@lists.php.net to get a copy of this message
Who says that I have a well-formed DTD? DTD is not necessary in many cases. I will illustrate with example why DOM is too "complex" ... compared to SimpleXML. <?php //These are my 2 XML documents. No DTD - just a simple xml structure. $xml1 = '<root1><q/><a><b><c><d>hi1</d></c></b></a><q/></root1>'; $xml2 = '<root2><q/><a><b><c><d>hi2</d></c></b></a><q/></root2>'; $sxe1 = new SimpleXMLElement ($xml1); $sxe2 = new SimpleXMLElement ($xml2); //Easy access to a node. It's great! echo $sxe1->a->b->c->d; echo $sxe2->a->b->c->d; //But how can I understand what is the name of the root node? $dom_sxe = dom_import_simplexml($sxe1); //Hooray, we've got node name echo $dom_sxe->nodeName; //And what happens if element sequence changes? . echo $dom_sxe->childNodes->item(1)->firstChild->firstChild->firstChild->nodeValue; //... hm... I prefer SimpleXML.

« previous php.internals (#19871) next »