1
我有嚴重的問題,訪問特定的XML文件的節點:SimpleXML的問題訪問XML節點
與print_r的我得到以下結果:
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
)
)
)
)
)
我想通過訪問命令 print $xml->recordset->record[0]->fields->field[0];
但我只收到錯誤:
Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/test.php on line 18
任何人都可以幫助我。 在此先感謝。
謝謝, 我很新的東西。對不起,我的小問題:-) – 2010-07-26 12:31:11