note 56442 added to ref.simplexml
| From: | mmacadams at casslin dot com | Date: | Fri, 02 Sep 2005 16:46:22 +0000 |
| Subject: | note 56442 added to ref.simplexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94666@lists.php.net to get a copy of this message | ||
it's important to note that PHP seems to disregard to first "all encompassing" tag...
for example:
$xmlstr="<order>
<billing_name>Matt</billing_name>
<billing_address>123 Main St.</billing_address>
</order>";
the 'billing_name' would be accessed by:
$xml = simplexml_load_string($xmlstr);
$billing_name = $xml->billing_name;
NOT:
$xml = simplexml_load_string($xml);
$billing_name = $xml->order->billing_name;
Maybe I'm just an idiot, but this took me a few hours to figure out.. (Partly due to the
similiarity between the words "movie" and "movies" in the Movie example at the
top of the page)
haha
hope this helps save someone some time! :)
----
Manual Page -- http://www.php.net/manual/en/ref.simplexml.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56442
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56442&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56442&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56442&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56442&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56442&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56442&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56442&report=yes
Search -- http://master.php.net/manage/user-notes.php