note 95240 added to intro.simplexml
| From: | Vector at ionisis dot com | Date: | Mon, 21 Dec 2009 02:57:26 +0000 |
| Subject: | note 95240 added to intro.simplexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164167@lists.php.net to get a copy of this message | ||
One aggravation of using this is that it does not help if you do NOT already know the tag names that
you are being given. After beating my head against my desk about this, i finally found a way to
access items by INDEX instead of NAME:
<?php
$x = new SimpleXMLElement($xml);
//both of these seem to work, for this purpose:
echo $x->{0}->getName();
echo $x[0]->getName();
?>
Another issue was in inability to name elements which have hyphens (-) in their name, such as
"checkout-order". Thankfully a user (Sebastian) on another page in this documentation ( http://www.php.net/manual/en/simplexmlelement.children.php#58199
) posted a solution to that.
----
Server IP: 69.147.83.197
Probable Submitter: 24.29.21.97
----
Manual Page -- http://www.php.net/manual/en/intro.simplexml.php
Edit -- https://master.php.net/note/edit/95240
Del: integrated -- https://master.php.net/note/delete/95240/integrated
Del: useless -- https://master.php.net/note/delete/95240/useless
Del: bad code -- https://master.php.net/note/delete/95240/bad+code
Del: spam -- https://master.php.net/note/delete/95240/spam
Del: non-english -- https://master.php.net/note/delete/95240/non-english
Del: in docs -- https://master.php.net/note/delete/95240/in+docs
Del: other reasons-- https://master.php.net/note/delete/95240
Reject -- https://master.php.net/note/reject/95240
Search -- https://master.php.net/manage/user-notes.php