Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过PHP的DOMDocument::schemaValidateSource()进行XSD minLength验证_Php_Xml_Xsd_Xsd Validation - Fatal编程技术网

通过PHP的DOMDocument::schemaValidateSource()进行XSD minLength验证

通过PHP的DOMDocument::schemaValidateSource()进行XSD minLength验证,php,xml,xsd,xsd-validation,Php,Xml,Xsd,Xsd Validation,我想通过XSD验证XML。 我必须指出,我的XSD工作得很好,除了这一块: <xs:element name="some_element"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="50"/> </xs:restriction> </xs:simpleType

我想通过XSD验证XML。 我必须指出,我的XSD工作得很好,除了这一块:

<xs:element name="some_element">
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:minLength value="50"/>
        </xs:restriction>
    </xs:simpleType>
</xs:element>
问题是,即使在或[100_chars_]上,它也会验证我没有错误,并且我希望该元素的最小内容长度为50

某处有虫子吗?我错过了什么?它可以在XSD中使用正则表达式模式,但我不想使用它们


我在WinXP上使用PHP5.3.5和libxml 2.7.7

从表面上看,它看起来像一个bug,但这里没有足够的信息来肯定这一点


您是否尝试过使用其他架构处理器运行验证?如果怀疑有bug,这应该是您的第一步,因为它可能会以某种方式确认它。

Hmm,我还没有想到这一点。有什么建议吗?我将检查XMLPad或Xerces.Yup,在命令行中使用libxml2.7.8的xmllint,验证失败;应该是这样的。谢谢你给我指明了正确的方向。
$dom = new DOMDocument();
$dom->loadXML($xml);

// handle errors manually
set_error_handler(array($this, 'errorHandler'));

// validate
$isValid = $dom->schemaValidateSource($xsd);

// restore default error handler
restore_error_handler();