note 60857 deleted from ref.simplexml by nlopess
| From: | nlopess@php.net | Date: | Wed, 18 Jan 2006 19:29:18 +0000 |
| Subject: | note 60857 deleted from ref.simplexml by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-102048@lists.php.net to get a copy of this message | ||
Note Submitter: franp at free dot fr
Reason: already in docs
----
To access individually the attributes of the root node, use $simpleXML['attribute name']
syntax.
<?php
$xmlstr = <<<XML
<?xml version="1.0"?>
<root someattribute="blabla">
<name>tom</name>
<sex>man</sex>
</root>
XML;
$sx = simplexml_load_string($xmlstr);
echo $sx['someattribute'];
// echo "blabla"
?>