note 61219 deleted from ref.simplexml by didou
| From: | didou@php.net | Date: | Tue, 16 Jan 2007 00:53:00 +0000 |
| Subject: | note 61219 deleted from ref.simplexml by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121769@lists.php.net to get a copy of this message | ||
Note Submitter: Jason
----
As noted by paul at preinheimer dot com in a lower note ( http://us3.php.net/manual/en/ref.simplexml.php#52583
);
If you want to access an element that has a dash in its name, (as is common with the XML documents
provided by the Library of Congress, as well as the NWS) you will need to handle it a little bit
differently.
You can either use XPATH, which works fine, but will return an array of results every time, even if
there is a single result.
eg.
$xml->xpath('/data/time-layout/start-valid-time'}
You can also choose just to encapsulate the element names containing a dash:
$xml->data->{'time-layout'}->{'start-valid-time'}