I have and XSD which gives the following error during the schema generation.
org.xml.sax.SAXParseException; systemId: file:/D:/Basil/Projects/myproducts.xsd; lineNumber: 577; columnNumber: 50; cos-all-limited.1.2: An 'all' model group must appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and that particle must be part of a pair which constitutes the '{'content type'}' of a complex type definition.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4124)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4107)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:588)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:555)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:521)
at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:240)
at com.sun.tools.xjc.reader.xmlschema.parser.SchemaConstraintChecker.check(SchemaConstraintChecker.java:101)
at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:357)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:167)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:113)
at com.sun.tools.xjc.Driver.run(Driver.java:313)
at org.codehaus.mojo.jaxb2.AbstractXjcMojo.execute(AbstractXjcMojo.java:298)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
The relevant XSD is pasted below. I'm unable to understand what the actual error is. Error is on the third line from end. Please help.
<xs:group name="prodVar">
<xs:all>
<xs:element name="prodVar" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="varName" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="skuList" />
<xs:element name="vStory" type="xs:string" minOccurs="0" />
<xs:element ref="attList" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="colorSwatchList" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="colorSwatch" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="swatchName" type="xs:string" minOccurs="0" />
<xs:element name="swatchHeight" type="xs:string" minOccurs="0" />
<xs:element name="swatchWidth" type="xs:string" minOccurs="0" />
<xs:element name="colorName" type="xs:string" minOccurs="0" />
<xs:element name="mainImageHeight" type="xs:string" minOccurs="0" />
<xs:element name="mainImageWidth" type="xs:string" minOccurs="0" />
<xs:element name="mainImageName" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:group>
<!--lot of other stuff -->
<xs:element name="prodVarList" minOccurs="0" maxOccurs="1">
<xs:complexType> <!-- ERROR HERE -->
<xs:group ref="prodVar" minOccurs="0" maxOccurs="unbounded" />
</xs:complexType>
</xs:element>
Just get rid of maxOccurs="unbounded"
in <xs:group ref="prodVar" minOccurs="0" maxOccurs="unbounded" />
In XSD 1.0, an xs:all
cannot repeat (here indirectly, some may say 'nice try!'), nor any particle under xs:all
, nor can it be nested under any other compositor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With