[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Problem with XML processing under PHP (code don't runs)
Hi, I read a tutorial about this topic. I have copied the code, and copy into a file. Here is the PHP code: --------------------------------------------- <?php // data file $file = "library.xml"; // initialize parser $xml_parser = xml_parser_create(); // set callback functions xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); // open XML file if (!($fp = fopen($file, "r"))) { die("Cannot locate XML data file: $file"); } // read and parse data while ($data = fread($fp, 4096)) { // error handler 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))); } } // clean up xml_parser_free($xml_parser); ?> --------------------------------------------- and here the XML file: --------------------------------------------- <?xml version="1.0"?> <library> <book> <title>Hannibal</title> <author>Thomas Harris</author> <genre>Suspense</genre> <pages>564</pages> <price>8.99</price> <rating>4</rating> </book> <book> <title>Run</title> <author>Douglas E. Winter</author> <genre>Thriller</genre> <pages>390</pages> <price>7.49</price> <rating>5</rating> </book> <book> <title>The Lord Of The Rings</title> <author>J. R. R. Tolkien</author> <genre>Fantasy</genre> <pages>3489</pages> <price>10.99</price> <rating>5</rating> </book> </library> --------------------------------------------- When I test the script with the Omnicron WebServer, I get these Error messages: --------------------------------------------- Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test. php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler startelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler characterdata() in F:\WebServer\HTDOCS\test.php on line 22 Warning: Unable to call handler endelement() in F:\WebServer\HTDOCS\test.php on line 22 --------------------------------------------- mmaaannnyyy warnings, isn't it ;) ? Why the code don't runs. I know Omnicron isn't a good WebServer, but Iam no proffessionel, and i want only to test my scripts, before uploading it to my hoster. Please help me :) cya _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|