/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/DomExample3b.txt

  • 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
<?PHP
 
5
        $dom = new DomDocument;
 
6
        $dom->preserveWhiteSpace = FALSE;
 
7
 
 
8
        $file = 'example1b.xml';
 
9
        $loadstate=$dom->load($file);   
 
10
        
 
11
        $xp = new DOMXPath($dom);
 
12
        
 
13
        
 
14
        $xpathString="//car";
 
15
        echo "<b>Example: ".$xpathString."</b><br>";
 
16
        $nodes = $xp->query($xpathString);
 
17
        foreach ($nodes as $node) {
 
18
 
 
19
                        $innerdom = new DomDocument;
 
20
                        $otherxml=$dom->saveXML($node);
 
21
                        $innerdom->loadXML($otherxml);
 
22
                        $innerxp = new DOMXPath($innerdom);
 
23
 
 
24
                        $xpathString="/car/*";
 
25
                        echo "<b>  Inner Example: ".$xpathString."</b><br>";
 
26
                        $innernodes = $innerxp->query($xpathString);
 
27
                        foreach ($innernodes as $innernode) {                   
 
28
                                        echo "    Name:".$innernode->nodeName."<br>";
 
29
                        }
 
30
  }
 
31
 
 
32
 
 
33
  
 
34
?>
 
35
</pre>
 
36
</body>
 
37
</html>
 
 
b'\\ No newline at end of file'