#!/usr/bin/php5 <?php include ("simpleparser/simpleparser.php"); $htmlText = file_get_contents('index.html'); if (! $htmlText ) { echo "Error opening $source_path\n"; return -1; } $parser = new SimpleParser($htmlText); while ($parser->nextNode()) { printf("%3d: ", $parser->LineNumber); printf("%3d", $parser->NodeNestingDepth); echo "|{$parser->NodeName}|{$parser->NodeSelfClosing}|{$parser->CData}"; if ($parser->NodeAttributes) { foreach($parser->NodeAttributes AS $key => $value) { echo "$key=>$value,"; } } echo "\n"; if ($parser->Errors) { echo "ERROR:\n\t"; echo implode("\n\t", $parser->Errors); echo "\n"; $parser->clearErrors(); } } ?>