bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/trunk
1
by Henrik G.
First seed of Lenasys ... Needs to be Organized Further |
1 |
<html>
|
2 |
<body>
|
|
3 |
<pre>
|
|
4 |
||
5 |
<?PHP
|
|
6 |
$dom = new DomDocument; |
|
7 |
$dom->preserveWhiteSpace = FALSE; |
|
8 |
||
9 |
$file = '../XMLData/example1b.xml'; |
|
10 |
$loadstate=$dom->load($file); |
|
11 |
||
12 |
$xp = new DOMXPath($dom); |
|
13 |
||
14 |
||
15 |
$xpathString="//car"; |
|
16 |
echo "<b>Example: ".$xpathString."</b><br>"; |
|
17 |
$nodes = $xp->query($xpathString); |
|
18 |
foreach ($nodes as $node) { |
|
19 |
||
20 |
$xpathString="./color"; |
|
21 |
echo "<b>Example: ".$xpathString."</b><br>"; |
|
22 |
$innernodes = $xp->query($xpathString,$node); |
|
23 |
foreach ($innernodes as $innernode) { |
|
24 |
echo " Name:".$innernode->nodeValue."<br>"; |
|
25 |
}
|
|
26 |
||
27 |
}
|
|
28 |
||
29 |
?>
|
|
30 |
</pre>
|
|
31 |
</body>
|
|
32 |
</html>
|