note 89500 deleted from function.simplexml-element-children by danbrown

From: Date: Wed, 16 Sep 2009 15:33:05 +0000
Subject: note 89500 deleted from function.simplexml-element-children by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160631@lists.php.net to get a copy of this message
Note Submitter: TSidoti ---- If you run into a tag that has both text and tags in it like lars dot a dot johansson, the best way to about about using that tag is to import it into dom using dom_import_simplexml(). According to http://devzone.zend.com/node/view/id/688 , simpleXML simply does not handle cases like this and will return only the tags. "The second solution is to bypass SimpleXML for certain portions of your document. One of the explicit design goals of PHP5's XML support was to allow all extensions to interoperate at a minimal cost. Since LibXML2 is the lingua franca of all XML extensions, DOM and SimpleXML objects can be exchanged with zero copies. It's just a different way of viewing the same underlying object! By this method, the DOM extension can "import" SimpleXML objects and use them as DOM objects, and vice versa. When you need to use a DOM feature you can, and when you need SimpleXML's ease of processing, you have that too." The other option in the article is to use the asXML() method and than parse the information from there.

« previous php.notes (#160631) next »