I do not understand why this line does not work : $info[$element] = $content;
but yet this works: echo $content; why? what is the trick? -- $xml_comment_file = basename($svg_file, '.svg.xml') .'.info.xml'; if (file_exists($xml_comment_file)) { $file = $xml_comment_file; $info = array(); $element = null; function startElement($parser, $name, $attrs) { global $element; $element = $name; } function endElement($parser, $name) { print ""; } function characterData($parser, $content) { global $info; global $element; $info[$element] = $content; //$info[$element] = sprintf("%s", $content); } $xml_parser = xml_parser_create(); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, FALSE); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); if (!($fp = fopen($file, 'r'))) die("could not open XML input\n"); while ($data = fread($fp, 4096)) if (!xml_parse($xml_parser, $data, feof($fp))) die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); xml_parser_free($xml_parser); print_r($info); } /* # the output is without $content : Array ( [info] => [file] => [orig-file] => [orig-author] => [bitmap-src] => [orig-date] => [svg-date] => ) */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php