- From: Shlomo Yona <S.Yona@F5.com>
- Date: Mon, 16 Apr 2007 00:56:37 -0700
- To: <xmlschema-dev@w3.org>
- Message-ID: <B546C312A37C12438A22154026CDC7E0135DC2D4@exchfive.olympus.f5net.com>
Hello,
In the following example schema the element <b/> can appear either as
part of a sequence model group or as part of a choice model group or as
an all model group.
This means that the instance does not follow the Unique Particle
Attribution Constraint (see: "Section 3.8.6: Constraints on Model Group
Schema Components " and Appendix H in "XML Schema Part 1: Structures
Second Edition, W3C Proposed Edited Recommendation").
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="" xmlns="foo">
<xsd:element name="a">
<xsd:complexType>
<xsd:sequence minOccurs="0"
maxOccurs="2">
<xsd:sequence
minOccurs="0" maxOccurs="2">
<xsd:element
ref="b" minOccurs="0" maxOccurs="2"/>
<xsd:element
ref="c" minOccurs="0" maxOccurs="2"/>
</xsd:sequence>
<xsd:choice
minOccurs="0" maxOccurs="2">
<xsd:element
ref="b" minOccurs="0" maxOccurs="2"/>
<xsd:element
ref="d" minOccurs="0" maxOccurs="2"/>
</xsd:choice>
<xsd:all minOccurs="0"
maxOccurs="1">
<xsd:element
ref="e" minOccurs="0" maxOccurs="2"/>
<xsd:element
ref="b" minOccurs="0" maxOccurs="2"/>
</xsd:all>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="b">
<xsd:complexType/>
</xsd:element>
<xsd:element name="c">
<xsd:complexType/>
</xsd:element>
<xsd:element name="d">
<xsd:complexType/>
</xsd:element>
<xsd:element name="e">
<xsd:complexType/>
</xsd:element>
</xsd:schema>
My question is: should the following example be valid against the schema
or not valid?
<a>
<b/><c/><b/>
</a>
I see that different XML validators behave differently on this example.
However, I did not see them report an error in the schema.
Now, please consider the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="bar" xmlns="foo">
<xsd:element name="a">
<xsd:complexType>
<xsd:sequence>
<xsd:sequence
minOccurs="0">
<xsd:element
name="b">
<xsd:complexType/>
</xsd:element>
</xsd:sequence>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Instance:
<a/>
Is it valid?
See, the element b might not appear and that's OK if you ask the inner
sequence but the outer sequence needs to "happen" once (the
minOccurs="1" is implied).
So, how should I read this? Is the above single <a/> element instance
valid or not with this schema? Is such a schema legal or not? If the
schema is not legal, must a schema processor report an error?
Thanks.
Shlomo.
Received on Monday, 16 April 2007 07:56:52 UTC