It disable libxml errors and allow user to fetch error information as needed
Example
<?php
libxml_use_internal_errors()
?>
It disable libxml errors and allow user to fetch error information as needed
Example
<?php
libxml_use_internal_errors()
?>
It set the streams context for the next libxml document load or write
It changes the default external entity loader
It returns last error from libxml
Example
<?php
libxml_get_last_error()
?>
It returns array of errors
Example
<?php
libxml_get_errors()
?>
It disable the ability to load external entities
Example
<?php
libxml_disable_entity_loader()
?>
It clears the libxml error buffer
Example
<?php
libxml_clear_errors()
?>
Example
<?php
$xmlparser=xml_parser_create();
function char($xmlparser,$data) {
echo $data;
}
function unparsed_ent_handler_func($xmlparser,$entname,$base,$sysID,$pubID,$notname){
echo $entname.$sysID.$pubID.$notname.
}
xml_set_character_data_handler($xmlparser,”char”);
xml_set_unparsed_entity_decl_handler($xmlparser,”unparsed_ent_handler_func”);
$fp=fopen(“test.xml”,”r”);
while ($data=fread($fp,4096)) {
xml_parse($xmlparser,$data,feof($fp)) or die(“Failed”);
}
xml_parser_free($xmlparser);
?>
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);
?>