
Mam problem z odczytem atrybutów date i time
Oto XML
<menu> <name id="29196545" date="17092008" time="1800"> <description> <cat>xxxxxx</cat> xxxxxxxxxxxxxxxx </description> <typ id="0"/> <opcje> <opcja team="43955">1</opcja> <opcja team="134063">2</opcja> </opcje> </name> </menu>
Oto skrypcik
<table border="1"> <tr> <td>id</td> <td>data</td> <td>godz</td> <td>nazwa</td> <td>opcja1</td> <td>opcja2</td> </tr> <?php $xml = simplexml_load_file('htt://www.adres.pl/xml.xml'); foreach ($xml->name as $foo) { $type = $foo->typ[0]->Attributes(); if ($type == '0') { $a = $foo->opcje->opcja[0]->Attributes(); $b = $foo->opcje->opcja[1]->Attributes(); $date = $foo[1]->Attributes(); $time = $foo[2]->Attributes(); } } ?> </table>
wyskakuje błąd dla
$date = $foo[1]->Attributes();
$time = $foo[2]->Attributes();
to w takim razie jak można odczytać atrybuty date i time