XML_Statistics
[ class tree: XML_Statistics ] [ index: XML_Statistics ] [ all elements ]

Source for file example2.php

Documentation is available at example2.php

  1. <?PHP
  2.     require_once 'XML/Statistics.php';
  3.     
  4.     $stat = new XML_Statistics();
  5.     $xml  implode("",file("http://pear.php.net/rss.php"));
  6.     
  7.     // analyze a string instead of a file
  8.     $result $stat->analyzeString($xml);
  9.     
  10.     if ($stat->isError($result)) {
  11.         die("Error: " $result->getMessage());
  12.     }
  13.     
  14.     echo    "Total tags: " $stat->countTag()."<br>";
  15.     echo    "Occurences of item: " $stat->countTag('item')."<br>";
  16.     echo    "Maximum nesting level: " $stat->getMaxDepth()."<br>";
  17.  
  18.     // these are the <item> tags => amount of news entries
  19.     echo    "Amount of Tags in depth 3: " $stat->countTagsInDepth(3)."<br>";
  20. ?>

Documentation generated on Mon, 11 Mar 2019 15:39:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.