Back to index

php5  5.3.10
dom1.inc
Go to the documentation of this file.
00001 <?PHP
00002 $xmlstr = "<?xml version='1.0' standalone='yes'?>
00003 <!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
00004 [ <!ENTITY sp \"spanish\">
00005 ]>
00006 <!-- lsfj  -->
00007 <chapter language='en'><title language='en'>Title</title>
00008 <para language='ge'>
00009 &sp;
00010 <!-- comment -->
00011 <informaltable language='&sp;kkk'>
00012 <tgroup cols='3'>
00013 <tbody>
00014 <row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row>
00015 <row><entry>a2</entry><entry>c2</entry></row>
00016 <row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
00017 </tbody>
00018 </tgroup>
00019 </informaltable>
00020 </para>
00021 </chapter> ";
00022 
00023 function print_node($node)
00024 {
00025   print "Node Name: " . $node->nodeName;
00026   print "\nNode Type: " . $node->nodeType;
00027   $child_count = $node->childNodes->length;
00028   print "\nNum Children: " . $child_count;
00029   if($child_count <= 1){
00030     print "\nNode Content: " . $node->nodeValue;
00031   }
00032   print "\n\n";
00033 }
00034 
00035 function print_node_list($nodelist)
00036 {
00037   foreach($nodelist as $node)
00038   {
00039     print_node($node);
00040   }
00041 }
00042 
00043 ?>