public static function validate($input)
    {
        if (is_string($input)) {
            $doc = new DOMDocument();
            $doc->preserveWhiteSpace = false;

            if (!@$doc->loadXML($input)) {
                throw InvalidXmlException::lastError();
            }

            $input = $doc;
        } elseif (!($input instanceof DOMDocument)) {
            throw InvalidArgumentException::create(
                'The $input argument must be an instance of DOMDocument, %s given.',
                gettype($input)
            );
        }

        if (!@$input->schemaValidate(self::SCHEMA)) {
            throw InvalidXmlException::lastError();
        }
    }
public static function validate($input)
    {
        if (is_string($input)) {
            $doc = new DOMDocument();
            $doc->preserveWhiteSpace = false;

            if (!@$doc->loadXML($input)) {
                throw InvalidXmlException::lastError();
            }

            $input = $doc;
        } elseif (!($input instanceof DOMDocument)) {
            throw InvalidArgumentException::create(
                'The $input argument must be an instance of DOMDocument, %s given.',
                gettype($input)
            );
        }

        if (!@$input->schemaValidate(self::SCHEMA)) {
            throw InvalidXmlException::lastError();
        }
    }
public static function validate ( $ input ) { if ( is_string ( $ input ) ) { $ doc = new DOMDocument ( ) ; $ doc -> preserveWhiteSpace = false ; if ( ! @ $ doc -> loadXML ( $ input ) ) { throw InvalidXmlException :: lastError ( ) ; } $ input = $ doc ; } elseif ( ! ( $ input instanceof DOMDocument ) ) { throw InvalidArgumentException :: create ( 'The $input argument must be an instance of DOMDocument, %s given.' , gettype ( $ input ) ) ; } if ( ! @ $ input -> schemaValidate ( self :: SCHEMA ) ) { throw InvalidXmlException :: lastError ( ) ; } }
Validates the annotations XML document.

@param DOMDocument|string $input The document to validate.

@throws Exception
@throws InvalidArgumentException If $input is not valid.
@throws InvalidXmlException      If the document is not valid.
Validates the annotations XML document .