File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / dom / examples / dom1.inc
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:54 2012 UTC (12 years, 10 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

<?PHP
$xmlstr = "<?xml version='1.0' standalone='yes'?>
<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
[ <!ENTITY sp \"spanish\">
]>
<!-- lsfj  -->
<chapter language='en'><title language='en'>Title</title>
<para language='ge'>
&sp;
<!-- comment -->
<informaltable language='&sp;kkk'>
<tgroup cols='3'>
<tbody>
<row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row>
<row><entry>a2</entry><entry>c2</entry></row>
<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
</tbody>
</tgroup>
</informaltable>
</para>
</chapter> ";

function print_node($node)
{
  print "Node Name: " . $node->nodeName;
  print "\nNode Type: " . $node->nodeType;
  $child_count = $node->childNodes->length;
  print "\nNum Children: " . $child_count;
  if($child_count <= 1){
    print "\nNode Content: " . $node->nodeValue;
  }
  print "\n\n";
}

function print_node_list($nodelist)
{
  foreach($nodelist as $node)
  {
    print_node($node);
  }
}

?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>