note 90440 added to book.simplexml
| From: | nickmaccarthy at gmail dot com | Date: | Wed, 22 Apr 2009 14:36:59 +0000 |
| Subject: | note 90440 added to book.simplexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-153585@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 209.41.74.194
Probable Submitter: 96.233.147.97
----
Manual Page -- http://www.php.net/manual/en/book.simplexml.php
Edit -- https://master.php.net/note/edit/90440
Del: integrated -- https://master.php.net/note/delete/90440/integrated
Del: useless -- https://master.php.net/note/delete/90440/useless
Del: bad code -- https://master.php.net/note/delete/90440/bad+code
Del: spam -- https://master.php.net/note/delete/90440/spam
Del: non-english -- https://master.php.net/note/delete/90440/non-english
Del: in docs -- https://master.php.net/note/delete/90440/in+docs
Del: other reasons-- https://master.php.net/note/delete/90440
Reject -- https://master.php.net/note/reject/90440
Search -- https://master.php.net/manage/user-notes.php