XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
xsd validation, complexType with large maxOccurs on choice

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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS