[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)

  • To: "" <xml-dev@l...>
  • Subject: Problem with XML processing under PHP (code don't runs)
  • From: "Marksman" <chris_ziel@y...>
  • Date: Sat, 9 Mar 2002 15:16:05 +0100

unable to call handler
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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.