SimpleXML and weird XML format (namespace?)
Posted: Sat Oct 10, 2009 12:04 am
Hello,
So far I've only worked with easy XML structures and SimeXMLElements.
Now I'm trying to access values from the XML returned by this API: http://api.hostip.info/?ip=12.215.42.19
The XML response looks like this:
How can I access the values in this XML tree? (preferably using SimpleXML)
Thank you!!
Paul
So far I've only worked with easy XML structures and SimeXMLElements.
Now I'm trying to access values from the XML returned by this API: http://api.hostip.info/?ip=12.215.42.19
The XML response looks like this:
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1" ?>
<HostipLookupResultSet version="1.0.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.hostip.info/api/hostip-1.0.0.xsd">
<gml:description>This is the Hostip Lookup Service</gml:description>
<gml:name>hostip</gml:name>
<gml:boundedBy>
<gml:Null>inapplicable</gml:Null>
</gml:boundedBy>
<gml:featureMember>
<Hostip>
<gml:name>Sugar Grove, IL</gml:name>
<countryName>UNITED STATES</countryName>
<countryAbbrev>US</countryAbbrev>
<!-- Co-ordinates are available as lng,lat -->
<ipLocation>
<gml:pointProperty>
<gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates>-88.4588,41.7696</gml:coordinates>
</gml:Point>
</gml:pointProperty>
</ipLocation>
</Hostip>
</gml:featureMember>
</HostipLookupResultSet>
Thank you!!
Paul