note 97562 added to class.simplexmlelement
| From: | hylke dot vanderschaaf at wur dot nl | Date: | Mon, 26 Apr 2010 10:13:51 +0000 |
| Subject: | note 97562 added to class.simplexmlelement | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168641@lists.php.net to get a copy of this message | ||
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?
----
Server IP: 69.147.83.197
Probable Submitter: 137.224.32.202
----
Manual Page -- http://www.php.net/manual/en/class.simplexmlelement.php
Edit -- https://master.php.net/note/edit/97562
Del: integrated -- https://master.php.net/note/delete/97562/integrated
Del: useless -- https://master.php.net/note/delete/97562/useless
Del: bad code -- https://master.php.net/note/delete/97562/bad+code
Del: spam -- https://master.php.net/note/delete/97562/spam
Del: non-english -- https://master.php.net/note/delete/97562/non-english
Del: in docs -- https://master.php.net/note/delete/97562/in+docs
Del: other reasons-- https://master.php.net/note/delete/97562
Reject -- https://master.php.net/note/reject/97562
Search -- https://master.php.net/manage/user-notes.php