note 90440 deleted from book.simplexml by jani
| From: | jani@php.net | Date: | Fri, 24 Apr 2009 13:53:15 +0000 |
| Subject: | note 90440 deleted from book.simplexml by jani | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153681@lists.php.net to get a copy of this message | ||
Note Submitter: nickmaccarthy at gmail dot com
----
Note: SimpleXML has issues parsing tags with ":" in it.
GML tags for example are formatted like:
<gml:name>Foo</gml:name>.
In our example below:
$xml->firstLayer->secondLayer->{'gml:name'}
will not be parsed by SimpleXML, but SimpleXML will NOT throw an error or lead you to believe that
it has NOT parsed it.
I was parsing output from hostip.info which uses XML as an output with GML. The solution I came up
with this is to use str_replace(":", "_", $xmlstr) which then allowed SimpleXML
to parse this accordingly since "_" will not break the parser.
Just an FYI out there to anyone who is trying to use this for parsing GML you will probably come
across the same issue.