note 95578 added to simplexmlelement.children
| From: | mrdaniellee at live dot com | Date: | Sun, 10 Jan 2010 17:11:36 +0000 |
| Subject: | note 95578 added to simplexmlelement.children | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164831@lists.php.net to get a copy of this message | ||
use this If you want to view the HTML as well as data.
normal dumps display the parsed versions of HTML.
This code displays the HTML as Text in a Text Area, and also display all other a data along side as
an array
perfect for debugging (xml with html).
Try This Code:
$xml = simplexml_load_file($url);
function xml2array_parse($xml){
foreach ($xml->children() as $parent => $child){
$return["$parent"] =
xml2array_parse($child)?xml2array_parse($child):"$child";
}
return $return;
}
print "<pre><textarea style=\"width:200%;height:100%;\">";
print_r(xml2array_parse($xml));
print "</textarea></pre>";
----
Server IP: 69.147.83.197
Probable Submitter: 81.100.181.240
----
Manual Page -- http://www.php.net/manual/en/simplexmlelement.children.php
Edit -- https://master.php.net/note/edit/95578
Del: integrated -- https://master.php.net/note/delete/95578/integrated
Del: useless -- https://master.php.net/note/delete/95578/useless
Del: bad code -- https://master.php.net/note/delete/95578/bad+code
Del: spam -- https://master.php.net/note/delete/95578/spam
Del: non-english -- https://master.php.net/note/delete/95578/non-english
Del: in docs -- https://master.php.net/note/delete/95578/in+docs
Del: other reasons-- https://master.php.net/note/delete/95578
Reject -- https://master.php.net/note/reject/95578
Search -- https://master.php.net/manage/user-notes.php