My problem is with parsing an XSD Schema that has elements with maxOccurs
larger than 5000 (but not unbounded
).
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
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).
My question is:
Thanks!
I had the same problem. I used this:
System.setProperty("jdk.xml.maxOccurLimit", "XXXXX");
I have found a solution that doesn't require changing the parser.
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
I came across this thread when looking for solutions for this problem when using xjc
command in console.
For anyone who is using xjc
command to parse xsd, this works for me:
$ xjc -nv foo.xsd
Be aware though:
By default, the XJC binding compiler performs strict validation of the source schema before processing it. Use this option to disable strict schema validation. This does not mean that the binding compiler will not perform any validation, but means that it will perform a less-strict validation.
So if you think your xsd is from a good source, using less strict validation should not be a problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With