Simple function I used while playing around with XMLReader.
<?php
function dump_xmlreader($o) {
$node_types = array (
0=>"No node type",
1=>"Start element",
2=>"Attribute node",
3=>"Text node",
4=>"CDATA node",
5=>"Entity Reference node",
6=>"Entity Declaration node",
7=>"Processing Instruction node",
8=>"Comment node",
9=>"Document node",
10=>"Document Type node",
11=>"Document Fragment node",
12=>"Notation node",
13=>"Whitespace node",
14=>"Significant Whitespace node",
15=>"End Element",
16=>"End Entity",
17=>"XML Declaration node"
);
echo "attributeCount = " . $o->attributeCount . "\n";
echo "baseURI = " . $o->baseURI . "\n";
echo "depth = " . $o->depth . "\n";
echo "hasAttributes = " . ( $o->hasAttributes ? 'TRUE' : 'FALSE' ) . "\n";
echo "hasValue = " . ( $o->hasValue ? 'TRUE' : 'FALSE' ) . "\n";
echo "isDefault = " . ( $o->isDefault ? 'TRUE' : 'FALSE' ) . "\n";
echo "isEmptyElement = " . ( @$o->isEmptyElement ? 'TRUE' : 'FALSE' ) . "\n";
echo "localName = " . $o->localName . "\n";
echo "name = " . $o->name . "\n";
echo "namespaceURI = " . $o->namespaceURI . "\n";
echo "nodeType = " . $o->nodeType . ' - ' . $node_types[$o->nodeType] . "\n";
echo "prefix = " . $o->prefix . "\n";
echo "value = " . $o->value . "\n";
echo "xmlLang = " . $o->xmlLang . "\n";
}
?>