Php SimpleXml访问xml节点的问题
我在访问特定xml文件的节点时遇到严重问题: 通过打印,我得到以下结果:Php SimpleXml访问xml节点的问题,php,xml,simplexml,Php,Xml,Simplexml,我在访问特定xml文件的节点时遇到严重问题: 通过打印,我得到以下结果: SimpleXMLElement Object ( [RecordSet] => SimpleXMLElement Object ( [@attributes] => Array ( [dataSource] => testdatabase [t
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
)
)
)
)
)
我试图通过命令访问
打印$xml->recordset->record[0]->fields->field[0]代码>
但我只得到一个错误:
Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/test.php on line 18
谁能帮我一下吗。
提前谢谢。。试一试
谢谢,我对这东西还不太熟悉。对不起,我的问题很琐碎:-)
$xml->RecordSet->Record[0]->Fields->Field[0]; // Barcelona