Workaround for XMLSchema not supporting maxOccurs larger than 5000

mzywiol picture mzywiol · May 20, 2013 · Viewed 11.7k times · Source

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:

  • Does someone know some other workaround in Xerces for this issue? Or
  • Can someone recommend another XML parser that does not have this limitation?

Thanks!

Answer

ToSa_Bn picture ToSa_Bn · Oct 29, 2014

I had the same problem. I used this:

System.setProperty("jdk.xml.maxOccurLimit", "XXXXX");