[
https://issues.apache.org/jira/browse/XERCESJ-1580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13631290#comment-13631290
]
Mukul Gandhi commented on XERCESJ-1580:
---------------------------------------
It seems to me that, the schema you've written can be equivalently written as
follows:
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<xsd:complexType name="fooType">
<xsd:all>
<xsd:element name="a" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="b" minOccurs="0" maxOccurs="100000"/>
</xsd:all>
</xsd:complexType>
<xsd:element name="doc" type="fooType"/>
</xsd:schema>
The above schema doesn't produce an OutOfMemoryError.
Following are further thoughts, wrt your example and my proposal,
1) in your schema an unbounded "a" is wrapped within a finite xs:sequence which
contains only "a". I think, this would be equivalent to <..
maxOccurs="unbounded" />. Lets name the result of this transformation as X.
2) you write a choice between X and b, and the choice has maxOccurs="100000". I
think, this would be equivalent to xsd:all syntax I've proposed. A
minOccurs="0" on both "a" and "b" ensures that, this works like a choice.
Thanks.
> Out of memory while validating an XML instance with a schema that contains
> particles with a large maxOccurs
> -----------------------------------------------------------------------------------------------------------
>
> Key: XERCESJ-1580
> URL: https://issues.apache.org/jira/browse/XERCESJ-1580
> Project: Xerces2-J
> Issue Type: Bug
> Components: XML Schema 1.1 Structures
> Reporter: Octavian Nadolu
> Priority: Critical
>
> I obtain an OutOfMemory exception when i validate the XML instance "test.xml"
> with the schema "test.xsd".
> You can reproduce the issue on the xml-schema-1.1-dev branch, using the
> jaxp.SourceValidator as follows:
> jaxp.SourceValidator -xsd11 -a test.xsd -i test.xml
> Please note that this exception occurs only if the "full schema checking"
> feature is disabled.
> XML instance: test.xml
> <doc>
> <a/>
> <b/>
> </doc>
> Schema: test.xsd
> <xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
> <xsd:complexType name='fooType' >
> <xsd:choice maxOccurs="100000">
> <xsd:sequence maxOccurs="100000000">
> <xsd:element name='a'
> maxOccurs="unbounded"/>
> </xsd:sequence>
> <xsd:element name="b"/>
> </xsd:choice>
> </xsd:complexType>
> <xsd:element name="doc" type="fooType"/>
> </xsd:schema>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]