[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xsd validation, complexType with large maxOccurs on choice

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

xsd validation
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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.