Bug 31199 - xerces 2.6.2 error with choice/sequence minOccurs inside a group
Summary: xerces 2.6.2 error with choice/sequence minOccurs inside a group
Status: NEW
Alias: None
Product: Xerces-J
Classification: Unclassified
Component: SAX (show other bugs)
Version: 1.2.3
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Xerces-J Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-13 16:12 UTC by Jacob Asiedu
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jacob Asiedu 2004-09-13 16:12:33 UTC
When i use the choice/sequence with maxOccurs inside a xs:group element and a 
i try to validate an instance document(shown below with schema),
the following error is reported by xerces:
"s4s-att-not-allowed:Attribute 'minOccurs' cannot appear in element 'sequence'.

The schema-schema seems to allow this, to the best of my understanding.

Here is the schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:group name="custGroup">
		<xs:sequence minOccurs="0">
			<xs:element name="customer" type="xs:string"/>
			<xs:element name="orderdetails" type="xs:string"/>
			<xs:element name="billto" type="xs:string"/>
			<xs:element name="shipto" type="xs:string"/>
		</xs:sequence>
	</xs:group>
	<xs:element name="order" type="ordertype"/>
	<xs:complexType name="ordertype">
		<xs:group ref="custGroup"/>
		<xs:attribute name="status" type="xs:string"/>
	</xs:complexType>
</xs:schema>

And here is the instance document: 
<?xml version="1.0" encoding="UTF-8"?>
<order xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="test1.xsd" status="String">
	<customer>String</customer>
	<orderdetails>String</orderdetails>
	<billto>String</billto>
	<shipto>String</shipto>
</order>
Comment 1 nddelima 2004-09-13 17:19:57 UTC
This appears to be invalid.  See section 3.7.2 of the W3C XML Schema Part 1: 
Structures Recommendation[1]... "Also note that in the first (named) case above 
no reference is made to minOccurs or maxOccurs: this is because the schema for 
schemas does not allow them on the child of <group> when it is named. This in 
turn is because the {min occurs} and {max occurs} of the particles which refer 
to the definition are what count."

Please use JIRA to report any new defects against Xerces-2J.

[1] http://www.w3.org/TR/xmlschema-1/#cModel_Group_Definitions
[2] http://nagoya.apache.org/jira