src/Viserio/Component/Parser/Utils/XmlUtils.php
public static function validateSchema(DOMDocument $dom, string $schema): array
    {
        $internalErrors  = \libxml_use_internal_errors(true);
        $disableEntities = \libxml_disable_entity_loader(false);
        $isValid         = @$dom->schemaValidateSource($schema);

        if (! $isValid) {
            \libxml_disable_entity_loader($disableEntities);

            return self::getXmlErrors($internalErrors);
        }

        \libxml_disable_entity_loader($disableEntities);

        $dom->normalizeDocument();

        \libxml_clear_errors();
        \libxml_use_internal_errors($internalErrors);

        return [];
    }
public static function validateSchema(DOMDocument $dom, string $schema): array
    {
        $internalErrors  = \libxml_use_internal_errors(true);
        $disableEntities = \libxml_disable_entity_loader(false);
        $isValid         = @$dom->schemaValidateSource($schema);

        if (! $isValid) {
            \libxml_disable_entity_loader($disableEntities);

            return self::getXmlErrors($internalErrors);
        }

        \libxml_disable_entity_loader($disableEntities);

        $dom->normalizeDocument();

        \libxml_clear_errors();
        \libxml_use_internal_errors($internalErrors);

        return [];
    }
Validates and parses the given file into a DOMDocument.

@param \DOMDocument $dom
@param string       $schema source of the schema

@throws \Viserio\Component\Contract\Parser\Exception\InvalidArgumentException

@return array