XMLSchema不支持maxOc的解决方法大于5000 [英] Workaround for XMLSchema not supporting maxOccurs larger than 5000
问题描述
我的问题是解析具有maxOccurs
大于5000的元素(但不是unbounded
)的XSD Schema.
My problem is with parsing an XSD Schema that has elements with maxOccurs
larger than 5000 (but not unbounded
).
这实际上是Xerces(我正在使用的版本2.9.1)或JAXP中的一个已知问题,如下所述: jsessionid = 85335466c2c1fc52f0245d20b2e?bug_id = 4990915"rel =" noreferrer> http://bugs.sun.com/view_bug.do;jsessionid=85335466c2c1fc52f0245d20b2e?bug_id=4990915
This is actually a know issue in either Xerces (which I'm using, version 2.9.1) or JAXP, as described here: http://bugs.sun.com/view_bug.do;jsessionid=85335466c2c1fc52f0245d20b2e?bug_id=4990915
我已经知道,如果我将XSD中的maxOccurs数字从大于5000的数字更改为unbounded
,则一切正常.不幸的是,对于我来说这不是一个选择(我无法插入XSD文件).
I already know that if I changed the maxOccurs numbers in my XSD from numbers larger than 5000 to unbounded
all works well. Sadly, this is not an option in my case (I cannot meddle with the XSD file).
我的问题是:
- 有人知道Xerces中针对此问题的其他解决方法吗?或者
- 有人可以推荐另一个没有此限制的XML解析器吗?
谢谢!
推荐答案
我找到了不需要更改解析器的解决方案.
I have found a solution that doesn't require changing the parser.
有一个 FEATURE_SECURE_PROCESSING
功能,其中maxOccurs限制为5000(以及其他几个限制).
There is a FEATURE_SECURE_PROCESSING
feature which puts that 5000 limitation on maxOccurs (along with several others).
And here is the document describing the limitations: http://docs.oracle.com/javase/7/docs/technotes/guides/xml/jaxp/JAXP-Compatibility_160.html#JAXP_security
这篇关于XMLSchema不支持maxOc的解决方法大于5000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!