src/CfdiUtils/CfdiValidator33.php
public function validate(string $xmlString, NodeInterface $node): Asserts
    {
        if ('' === $xmlString) {
            throw new \UnexpectedValueException('The xml string to validate cannot be empty');
        }

        $factory = new MultiValidatorFactory();
        $validator = $factory->newReceived33();

        $hydrater = new Hydrater();
        $hydrater->setXmlString($xmlString);
        $hydrater->setXmlResolver(($this->hasXmlResolver()) ? $this->getXmlResolver() : null);
        $hydrater->setXsltBuilder($this->getXsltBuilder());
        $validator->hydrate($hydrater);

        $asserts = new Asserts();
        $validator->validate($node, $asserts);

        return $asserts;
    }
public function validate(string $xmlString, NodeInterface $node): Asserts
    {
        if ('' === $xmlString) {
            throw new \UnexpectedValueException('The xml string to validate cannot be empty');
        }

        $factory = new MultiValidatorFactory();
        $validator = $factory->newReceived33();

        $hydrater = new Hydrater();
        $hydrater->setXmlString($xmlString);
        $hydrater->setXmlResolver(($this->hasXmlResolver()) ? $this->getXmlResolver() : null);
        $hydrater->setXsltBuilder($this->getXsltBuilder());
        $validator->hydrate($hydrater);

        $asserts = new Asserts();
        $validator->validate($node, $asserts);

        return $asserts;
    }
public function validate ( string $ xmlString , NodeInterface $ node ) : Asserts { if ( '' === $ xmlString ) { throw new \ UnexpectedValueException ( 'The xml string to validate cannot be empty' ) ; } $ factory = new MultiValidatorFactory ( ) ; $ validator = $ factory -> newReceived33 ( ) ; $ hydrater = new Hydrater ( ) ; $ hydrater -> setXmlString ( $ xmlString ) ; $ hydrater -> setXmlResolver ( ( $ this -> hasXmlResolver ( ) ) ? $ this -> getXmlResolver ( ) : null ) ; $ hydrater -> setXsltBuilder ( $ this -> getXsltBuilder ( ) ) ; $ validator -> hydrate ( $ hydrater ) ; $ asserts = new Asserts ( ) ; $ validator -> validate ( $ node , $ asserts ) ; return $ asserts ; }
Validate and return the asserts from the validation process.
This method can use a xml string and a NodeInterface,
is your responsability that the node is the representation of the content.

@param string $xmlString
@param NodeInterface $node
@return Asserts|\CfdiUtils\Validate\Assert[]
Validate and return the asserts from the validation process . This method can use a xml string and a NodeInterface is your responsability that the node is the representation of the content .