Hi, I'm wondering is there is some way to reach directly node instead of using loop. My example is: ======================================================= $doc = new DOMDocument(); $doc->load('test.xml'); $xp = new domxpath($doc); $titles = $xp->query("//Lines/Line/*"); foreach ($titles as $node) { if($node->nodeName=="LineNumber") { $LineNumber = $node->nodeValue; } } ======================================================= Instead of passing through each element can I call it directly in some way? Something like 'node->nodeName['lineNumber'].value'... If someone was playing with DOM and could help... thanks in advance. G.
First of all, as far as I know you can selected needed node somekind like $titles = $xp->query("//Lines/Line/[5]"); PHP: Or you can get like this $titles = $xpath->query("//Lines/Line/"); $titles->item(4)->nodeValue; PHP: