XML parser error ..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all 

I am novice in XML. I have just started to creating PHP parser for XML
files. I am using SAX. 
the file is : -
<html> 

<head> 

<basefont face="Arial"> 

</head> 

<body> 



<?php 



// cdata handler 

function characterDataHandler($parser, $data) 

{

      echo $data . "<p>"; 

} 



// PI handler 

function PIHandler($parser, $target, $data) 

{

      // if php code, execute it 

      if (strtolower($target) == "php") 

      {

           eval($data); 

      } 

      // otherwise just print it 

      else 

      {

            echo "PI found: [$target] $data"; 

      } 

} 



// XML data 

$xml_data = <<<EOF 

<?xml version="1.0"?> 

<article> 

      <header>insert slug here</header> 

      <body>insert body here</body> 

      <footer><?php print "Copyright UNoHoo Inc," . date("Y", mktime());
?></footer>   

</article> 

EOF; 



// initialize parser 

$xml_parser = xml_parser_create(); 



// set cdata handler 

xml_set_character_data_handler($xml_parser, "characterDataHandler"); 



// set PI handler 

xml_set_processing_instruction_handler($xml_parser, "PIHandler"); 



if (!xml_parse($xml_parser, $xml_data)) 

{

      die("XML parser error: " . 

xml_error_string(xml_get_error_code($xml_parser))); 

} 



// all done, clean up! 

xml_parser_free($xml_parser); 



?> 

</body> 

</html> 

it give this output " XML parser error: Reserved XML Name" 
even i created two more php files but it give same message as out put. 
I am unable to understand why its come. 

Please help me out.
onewaylife
-- 
View this message in context: http://www.nabble.com/XML-parser-error-..-tf2677513.html#a7467514
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux