accessing node from DomDocument
domaccess.php:
<?php

$dom 
= new DomDocument();
$dom->load("examples/books.xml");

print 
"--- getElementsByTagName ---\n";
foreach (
$dom->getElementsByTagName("subject") as $node) {
    print 
$node->nodeValue."\n";
}

print 
"--- getElementsByTagNameNS --- \n";
foreach (
$dom->getElementsByTagNameNS("http://purl.org/dc/elements/1.1/","subject") as $node) {
    print 
$node->nodeValue."\n";
}

print 
"--- getElementyById --- \n";
print 
"does not work, no id is defined\n";
var_dump($dom->getElementById("1"));
    
    


 
accessing node from DomDocument © copyright 2004  Bitflux GmbH