Listing B
<?php // include class file include ("XML/Statistics.php"); // create object $xs = new XML_Statistics(); // define XML string $xml = "<?xml version='1.0'?><table><field>id</field><field>fname</field><field>lname</fie ld><field>age</field><field>active</field></table>"; // analyze string $xs->analyzeString($xml); // count number of <field> elements echo "String contains " . $xs->countTag('field') . " fields"; ?>