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>
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