<?php //This is under the GPL3 license. //$contents = @file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/stuff.xml'); //XML file must be ascii encoded! $contents = @file_get_contents('SVGDemo.xml'); $parser = xml_parser_create(); // WORKS JUST FINE $xmlArray=array(); $tags=array(); xml_parse_into_struct($parser, $contents, $xmlArray, $tags); // print_r($xmlArray); print_r($tags); xml_parser_free($parser); ?>
a more complete XML parser with example of traversing the XML parsed array can be found at PHP XML-based Menu Generator on this site - code is also GPL'd.