[Home] [By Thread] [By Date] [Recent Entries]

  • From: Mukul Gandhi <mukulg@s...>
  • To: XML Developers List <xml-dev@l...>
  • Date: Sat, 14 May 2022 19:47:37 +0530

Hi all,
   I've tried to do following XML Schema validation, using three different XML Schema processors.

XML instance document,

<X>
  <a>hello</a>
  <b>world</b>
</X>

XML Schema document,

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
   
    <xs:element name="X">
       <xs:complexType>
          <xs:choice maxOccurs="50000">
             <xs:element name="a" type="xs:string"/>
             <xs:element name="b" type="xs:string"/>
          </xs:choice>
       </xs:complexType>
    </xs:element>

</xs:schema>

1) XercesJ with default options, reports,

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Though XercesJ can avoid this error, by setting a limit via an API, on the number of complexType content model nodes that are created.

Or if we write, xs:choice maxOccurs="unbounded", XercesJ has no issues.

2) Saxon reports,

Warning on line 5 of test.xsd:
   maxOccurs value of 50000 treated as unbounded

3) .NET XML Schema validator, has no issues with the example posted within this mail, and works perfectly fine (i.e, xs:choice maxOccurs="50000" is handled without any issues). That looks great to me.

I wonder, how .NET XML Schema validator is able to handle the example posted within this mail, that the other two XML Schema processers that I've mentioned cannot.



--
Regards,
Mukul Gandhi


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member