Workaround for XMLSchema not supporting maxOccurs larger than 5000(XMLSchema 的解决方法不支持 maxOccurs 大于 5000)
问题描述
我的问题是解析具有大于 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:XMLSchema 的解决方法不支持 maxOccurs 大于 5000


基础教程推荐
- 如何强制对超级方法进行多态调用? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01