xml + xpath, baskı unsuru

0 Cevap php
Notice: Undefined property: DOMNodeList::$id in D:\wamp\www\xml\index.php on line 15
id:

Notice: Undefined property: DOMNodeList::$name in D:\wamp\www\xml\index.php on line 16
name:

<?php
$xml = new DOMDocument();

$xml->load('test.xml');

$xpath = new DOMXPath($xml);

$query = '/people/person[id="33333"]';

$entries = $xpath->query($query);

echo 'id:'. $entries->id.'<br/>';
echo 'name:'.$entries->name.'<br/>';
?>

xml dosyası örnek:

<people>
...
    <person>
        <phone>33333</phone>
        <name>Aadgar</name>
        <last_name>Adas</last_name>
    </person>
...
</people>

0 Cevap