PHP: Check if XML is valid with SimpleXmlElement

Just a short function that checks if a XML file’s structure is valid:

I had to use libxml_use_internal_errors, because otherwise PHP would output a Warning like this: “PHP Warning: SimpleXMLElement::__construct() …”

Comments are closed.