Often my .xml document contains errors. I would want to parse my document anyway up to errors or try to fix errors automatically. Is that possible?
I have tried this, but it isn't working
$xml = simplexml_load_file($url, "SimpleXMLElement", array(LIBXML_NOERROR, LIBXML_ERR_NONE));
if (!$xml) {
echo "Failed loading XML\n";
foreach(libxml_get_errors() as $error) {
echo "\t", $error->message;
}
}