Listing D
<?php // include class file include ("XML/Statistics.php"); // create object $xs = new XML_Statistics(); // define XML string $xml = "<?xml version='1.0'?><site><url>http://www.builder.com</url><description>A resource for Web developers</description></site>"; // analyze string $xs->analyzeString($xml); // count number of CDATA blocks // and total number of characters echo "String contains " . $xs->countDataChunks() . " CDATA blocks and " . $xs->getCDataLength() . " characters"; ?>