<html>
<body>
<h3 style="color: darkgreen;">xml_set_notation_decl_handler() function example in PHP</h3>
<?php
$xml_parser=xml_parser_create();
function char($xml_parser,$xml_data)
{
echo $xml_data;
}
function ext_ent_handler($xml_parser,$ent,$base,$sysID,$pubID)
{
echo "$not<br />";
echo "$sysID<br />";
echo "$pubID<BR />";
}
xml_set_character_data_handler($xml_parser,"char");
xml_set_notation_decl_handler($xml_parser, "ext_ent_handler");
$fp=fopen("test1.xml","r");
while ($xml_data=fread($fp,4096))
{
xml_parse($xml_parser,$xml_data,feof($fp)) or
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);
?>
</body>
</html>
|