xml_set_external_entity_ref_handler()

It set up  external entity reference handler

Example

<?php
$xmlparser=xml_parser_create();

function char($xmlparser,$data){
echo $data;
}

function ext_func($xmlparser,$ent,$base,$sysID,$pubID) {
echo $ent.”<br />”;
echo $sysID.”<br />”;
echo $pubID.”<BR />”;
}

xml_set_character_data_handler($xmlparser,”char”);
xml_set_external_entity_ref_handler($xmlparser, “ext_func”);
$fp=fopen(“book.xml”,”r”);

while ($data=fread($fp,4096))
{
xml_parse($xmlparser,$data,feof($fp)) or die(“Failed”);
}

xml_parser_free($xmlparser);
?>

Share