/lenasys/0.1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/0.1

« back to all changes in this revision

Viewing changes to trunk/CodeViewer/DomExample3b/DomExample3bcode.php

  • Committer: Henrik G.
  • Date: 2013-03-26 23:22:55 UTC
  • Revision ID: henrik.gustavsson@his.se-20130326232255-ik6snyatlbkf3zs1
First seed of Lenasys ... Needs to be Organized Further

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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>
 
 
b'\\ No newline at end of file'