This example demonstrates the basic usage of libxml errors and the value
returned by this function.
<?php
// enable user error handling
var_dump(libxml_use_internal_errors(true));
$doc = DOMDocument::load('file.xml');
if (!$doc) {
$errors = libxml_get_errors();
foreach ($errors as $error) {
// handle errors here
}
libxml_clear_errors();
}
?>
The above example will output: