XML parser error ..
| From: | onewaylife | Date: | Tue, 21 Nov 2006 08:30:36 +0000 |
| Subject: | XML parser error .. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-244942@lists.php.net to get a copy of this message | ||
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.