<?php
include 'example.inc';
$dom = domxml_open_mem($xmlstr);
$chapter = $dom->document_element();
// Let's see the elements contained in chapter
foreach($chapter->child_nodes() as $node) {
if ($node->node_type() == XML_ELEMENT_NODE) {
echo $node->node_name() . "\n";
}
}
?>
The above example will output: