Sax Error Handling
saxerror.php:
<?php
$parser_object 
xml_parser_create();
doParse($parser_object);

function 
doParse($parser_object) {
    if (!(
$fp fopen("examples/books-invalid.xml""r")));    
    while (
$daten fread($fp4096))
    {
        
//if parse error, xml_parse return false
        
if(!xml_parse($parser_object$datenfeof($fp))) {
            
// echo error data
            
die(sprintf("\nXML error: %s in linie %d, spalte %d",
                
xml_error_string(xml_get_error_code($parser_object)),
                
xml_get_current_line_number($parser_object),
                
xml_get_current_column_number($parser_object)));
        }
    }
}

?>
 
Sax Object Handling © copyright 2004  Bitflux GmbH