src/XML.php
public static function loadSimpleXML($xml_file, $verify_dtd = true){

		$options = ($verify_dtd ? LIBXML_DTDVALID : null);

		libxml_clear_errors();
		$SimpleXML = @simplexml_load_file($xml_file, null, $options);
		$LibXMLError = libxml_get_last_error();

		if($SimpleXML === false || $LibXMLError instanceof \LibXMLError){

			if($LibXMLError instanceof \LibXMLError){

				$xml_base = basename($LibXMLError->file);

				throw new XMLException("{$LibXMLError->message} in $xml_base
					on line {$LibXMLError->line}");
			}

			else{

				$xml_base = basename($xml_file);

				throw new XMLException("SimpleXML failed to load $xml_base,
					unknown error");
			}
		}

		return $SimpleXML;
	}
public static function loadSimpleXML($xml_file, $verify_dtd = true){

		$options = ($verify_dtd ? LIBXML_DTDVALID : null);

		libxml_clear_errors();
		$SimpleXML = @simplexml_load_file($xml_file, null, $options);
		$LibXMLError = libxml_get_last_error();

		if($SimpleXML === false || $LibXMLError instanceof \LibXMLError){

			if($LibXMLError instanceof \LibXMLError){

				$xml_base = basename($LibXMLError->file);

				throw new XMLException("{$LibXMLError->message} in $xml_base
					on line {$LibXMLError->line}");
			}

			else{

				$xml_base = basename($xml_file);

				throw new XMLException("SimpleXML failed to load $xml_base,
					unknown error");
			}
		}

		return $SimpleXML;
	}
public static function loadSimpleXML ( $ xml_file , $ verify_dtd = true ) { $ options = ( $ verify_dtd ? LIBXML_DTDVALID : null ) ; libxml_clear_errors ( ) ; $ SimpleXML = @ simplexml_load_file ( $ xml_file , null , $ options ) ; $ LibXMLError = libxml_get_last_error ( ) ; if ( $ SimpleXML === false || $ LibXMLError instanceof \ LibXMLError ) { if ( $ LibXMLError instanceof \ LibXMLError ) { $ xml_base = basename ( $ LibXMLError -> file ) ; throw new XMLException ( "{$LibXMLError->message} in $xml_base
					on line {$LibXMLError->line}" ) ; } else { $ xml_base = basename ( $ xml_file ) ; throw new XMLException ( "SimpleXML failed to load $xml_base,
					unknown error" ) ; } } return $ SimpleXML ; }
Load and verify an XML-file using SimpleXML.

<p>The optional second parameter {@link $verify_dtd} can be used to
disable verification of the XML DTD upon loading. By default the DTD is
verified.</p>

<p>When an error occurs this methods throws a XMLException.</p>

@param string $xml_file
@param boolean $verify_dtd
@return \SimpleXMLElement
@throws XMLException
Load and verify an XML - file using SimpleXML .