SimpleXml problems accessing xml nodes
i have serious problems accessing nodes of a specific xml file:
http://write.fm/cqsmrf5
with print_r i get the following result:
开发者_如何转开发SimpleXMLElement Object
(
[RecordSet] => SimpleXMLElement Object
(
[@attributes] => Array
(
[dataSource] => testdatabase
[totalRecordCount] => 3573
)
[Record] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[counter] => 1
)
[Fields] => SimpleXMLElement Object
(
[Field] => Array
(
[0] => Barcelona
[1] => 1
)
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[counter] => 2
)
[Fields] => SimpleXMLElement Object
(
[Field] => Array
(
[0] => Cádiz
[1] => 2
)
)
)
)
)
I tried to access through the command
print $xml->recordset->record[0]->fields->field[0];
But i only get the error:
Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/test.php on line 18
Could anyone help me out. Thanks in advance.
XML is case-sensitive. Try
$xml->RecordSet->Record[0]->Fields->Field[0]; // Barcelona
精彩评论