tags:

views:

25

answers:

1

Hello Guys, 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.

+2  A: 

XML is case-sensitive. Try

$xml->RecordSet->Record[0]->Fields->Field[0]; // Barcelona
Gordon
Thanks,i'm pretty new to this stuff. Sorry for my trivial question :-)
Simon D.