Welcome Guest, Not a member yet? Register   Sign In
XML Parsing problem using simpleXML
#1

[eluser]bijon[/eluser]
I am trying to parse an XML data using the simplexml .I get the nested object .I am not able to parse that nested object . Here is the sample code.
Code:
url    = "http://usp1.blinkx.com/partnerapi/user/?uid=1ibdckbebe&text=cricket";
$xmlstr = file_get_contents($url);
$xml = simplexml_load_string($xmlstr);
print_r ($xml);
echo $xml->action;
And i got the output like
Quote: SimpleXMLElement Object
(
[action] => QUERY
[response] => SUCCESS
[responsedata] => SimpleXMLElement Object
(
)

)
QUERY
So now how can i parse the data of responsedata
#2

[eluser]Negligence[/eluser]
It's working... it's printing the value of 'action', which is 'QUERY'
#3

[eluser]phusiondesign[/eluser]
How can I retrieve say the latitude part of this xml output using simple xml?

Code:
<ResultSet xsi:schemaLocation="urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd">
  <Result precision="address">
    <Latitude>38.898590</Latitude>
    <Longitude>-77.035971</Longitude>
    <Address>1600 Pennsylvania Ave NW</Address>
    <City>Washington</City>
    <State>DC</State>
    <Zip>20006</Zip>
    <Country>US</Country>
  </Result>
</ResultSet>
#4

[eluser]Jamie Rumbelow[/eluser]
Code:
$str = file_get_contents("file.xml");
$xml = simplexml_load_string($str);
$xml->Latitude
#5

[eluser]phusiondesign[/eluser]
[quote author="Jemgames" date="1208392542"]
Code:
$str = file_get_contents("file.xml");
$xml = simplexml_load_string($str);
$xml->Latitude
[/quote]

That is what I tried, but it just returns the following...

Code:
SimpleXMLElement Object ( )

Any thoughts?




Theme © iAndrew 2016 - Forum software by © MyBB