大型模式文件的XML模式验证

3

我正在尝试使用xmllint验证模式,我相信它在底层使用了libxml2库。

问题是我有一个非常大的约10MB的模式文件。当我执行以下操作时:

xmllint --schema j9.xsd --noout jsample.xml

我得到了以下错误信息:
j9.xsd:65535: element annotation: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))).
j9.xsd:65535: element annotation: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))).

这个问题似乎是由于某个库的限制导致的,如果出现错误,行号不应该是65535。我想知道是否有另一个库没有这个限制,或者是否有人知道如何修复这个bug。谢谢!


Chaim提到的补丁对你有用吗? - Bhushan
补丁工作正常。我不知道它们是为哪个版本编写的,所以我手动打了libxml版本2.7.6的补丁,现在可以正确获取错误行的行号。 - Alexey Sviridov
1个回答

2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接