public function validate($value)
    {
        if (!$value instanceof DOMDocument) {
            $this->errors[] = TypeValidationError::xmlValidationFailed('Expected value of type DOMDocument');

            return;
        }

        $originalErrorLevel = \libxml_use_internal_errors(true);
        $value->schemaValidateSource($this->xml);
        $errors = \libxml_get_errors();
        \libxml_clear_errors();
        if ($errors) {
            foreach ($errors as $error) {
                $this->errors[] = TypeValidationError::xmlValidationFailed($error->message);
            }

            return;
        }

        \libxml_use_internal_errors($originalErrorLevel);
    }
public function validate($value)
    {
        if (!$value instanceof DOMDocument) {
            $this->errors[] = TypeValidationError::xmlValidationFailed('Expected value of type DOMDocument');

            return;
        }

        $originalErrorLevel = \libxml_use_internal_errors(true);
        $value->schemaValidateSource($this->xml);
        $errors = \libxml_get_errors();
        \libxml_clear_errors();
        if ($errors) {
            foreach ($errors as $error) {
                $this->errors[] = TypeValidationError::xmlValidationFailed($error->message);
            }

            return;
        }

        \libxml_use_internal_errors($originalErrorLevel);
    }
public function validate ( $ value ) { if ( ! $ value instanceof DOMDocument ) { $ this -> errors [ ] = TypeValidationError :: xmlValidationFailed ( 'Expected value of type DOMDocument' ) ; return ; } $ originalErrorLevel = \ libxml_use_internal_errors ( true ) ; $ value -> schemaValidateSource ( $ this -> xml ) ; $ errors = \ libxml_get_errors ( ) ; \ libxml_clear_errors ( ) ; if ( $ errors ) { foreach ( $ errors as $ error ) { $ this -> errors [ ] = TypeValidationError :: xmlValidationFailed ( $ error -> message ) ; } return ; } \ libxml_use_internal_errors ( $ originalErrorLevel ) ; }
Validate an XML string against the schema


@throws \Exception
Validate an XML string against the schema