note 97562 rejected from class.simplexmlelement by danbrown

From: Date: Mon, 26 Apr 2010 14:29:31 +0000
Subject: note 97562 rejected from class.simplexmlelement by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168651@lists.php.net to get a copy of this message
Note Submitter: hylke dot vanderschaaf at wur dot nl ---- It seems simpleXML has no nice way to handle nodes containing mixed text and other nodes. If you have the xml: <?php $xmlString = '<node>starting text <b>bold text</b> ending text</node>'; ?> The resulting SimpleXMLElement will have only 1 child, unlike the DOM library which will also gives you two #text elements. With SimpleXML you can no longer get the individual bits of text "starting text " and " ending text". If you convert the SimpleXMLElement to a string, you'll get a single string "starting text ending text" without the middle element, which also seems very counter intuitive to me. Am I missing something here?

« previous php.notes (#168651) next »