Listing F
<?php

// include class file
include ("XML/Statistics.php");

// create object
$xs = new XML_Statistics();

// define XML string
$xmlFile = "receipt.xml";

// analyze string
$xs->analyzeFile($xmlFile);

// get maximum depth
$md = $xs->getMaxDepth();

echo "Maximum depth of XML tree is $md";

// print number of elements at each level
for ($x=1; $x<=$md; $x++)
{
	echo $xs->countTagsInDepth($x) . "  element(s) at level $x "; } 
?>