問題描述
我的問題是解析具有大于 5000 的 maxOccurs
元素(但不是 unbounded
)的 XSD 架構.
My problem is with parsing an XSD Schema that has elements with maxOccurs
larger than 5000 (but not unbounded
).
這實際上是 Xerces(我正在使用,版本 2.9.1)或 JAXP 中的一個已知問題,如下所述: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).
這里是描述限制的文檔:http://docs.oracle.com/javase/7/docs/technotes/guides/xml/jaxp/JAXP-Compatibility_160.html#JAXP_security
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 的解決方法不支持 maxOccurs 大于 5000的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!