Dear all,
I have 2 questions on the XMLSchema spec:
- When looking at http://www.w3.org/TR/xmlschema-1/#declare-contentModel
I read that all-modelgroups can only contain element-particles and
choice-modelGroups and sequence-modelgroups only element,
choice-modegroup, sequence-modelgroup and any-particles. It is possible
though to add a group-particle to a choice/sequence-modelgroup that
references an all-modelGroup like in:
<snip>
<xsd:group name="testallgroup">
<xsd:all>
<xsd:element name="billTest" type="xsd:string"/>
<xsd:element name="billOtherTest" type="xsd:string"/>
</xsd:all>
</xsd:group>
<xsd:complexType name="PurchaseOrderType">
<xsd:sequence>
<xsd:group ref="testallgroup"/>
<xsd:element name="shipTo" type="USAddress"/>
<xsd:element name="billTo" type="USAddress"/>
<xsd:element ref="comment" minOccurs="0"/>
<xsd:element name="items" type="Items"/>
</xsd:sequence>
<xsd:attribute name="orderDate" type="xsd:date"/>
</xsd:complexType>
</snip>
Isn't this incoherent? I have tested the schema in XSV and it
validates.
- I am developing an SAX-based XMLSchema validator based on JaxMeXS
and was wondering about this: I was always convinced that it was
illegal to have two elements with the same name in the same modelgroup.
For example:
<snip>
<xsd:complexType name="USAddress">
<xsd:choice>
<xsd:element name="name" type="xsd:integer"/>
<xsd:element name="name" type="xsd:boolean"/>
</xsd:choice>
<xsd:attribute name="country" type="xsd:NMTOKEN"
fixed="US"/>
</xsd:complexType>
</snip>
When validating an element of type USAddress and hitting an element
though a SAX event: we can not be sure if the type of the element will
be xsd:integer or xsd:boolean. In this case this is not really a
problem, but it becomes one when the elements have complex type. The
above schema validates in XSV but not in XMLMind. I also don't find
anything in the spec that would allow/disallow this....
Mik