xml_set_processing_instruction_handler()

It  set up processing instruction (PI) handler

Example

<?php
$xmlparser=xml_parser_create();

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

function pi_handler_func($xmlparser, $target, $data) {
echo $target.$data;
}

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

while ($data=fread($fp,4096)){
xml_parse($xmlparser,$data,feof($fp));
}

xml_parser_free($xmlparser);
?>

Share