eval {
my $p = XML::SAX::ParserFactory->parser(Handler => $handler);
$p->parse_uri($document_path);
};
if($@) {
if($@->isa('XML::SAX::Exception::Parse')) {
log("$@");
# reject the document, but carry on
}
else {
# give up, there's a more serious error
}
}