It set up start and end element handlers
Example
<?php
$xmlparser=xml_parser_create();
function start($xmlparser,$element_name,$element_attrs) {
echo $element_name;
}
function stop($xmlparser,$element_name){
echo “n”;
}
function char($xmlparser,$data) {
echo $data;
}
xml_set_element_handler($xmlparser,”start”,”stop”);
xml_set_character_data_handler($xmlparser,”char”);
$fp=fopen(“book.xml”,”r”);
while ($data=fread($fp,4096)){
xml_parse($xmlparser,$data,feof($fp));
}
xml_parser_free($xmlparser);
?>