- From: Mukul Gandhi <gandhi.mukul@gmail.com>
- Date: Tue, 19 Jun 2012 21:16:45 +0100
- To: "Costello, Roger L." <costello@mitre.org>
- Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Hi Roger, Here's an example that illustrates this scenario, XSD schema: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="X"> <xs:complexType> <xs:sequence> <xs:element ref="Y" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Y" type="T1"> <xs:key name="PK"> <xs:selector xpath="a"/> <xs:field xpath="."/> </xs:key> </xs:element> <xs:element name="S1" type="T1" substitutionGroup="Y"/> <xs:complexType name="T1"> <xs:sequence> <xs:element name="a" type="xs:string" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:schema> The above schema would cause following XML document to be assessed as 'invalid' (since the value "a1" occurs more than once within the first "Y" element), <X> <Y> <a>a1</a> <a>a1</a> <a>a3</a> </Y> <Y> <a>a1</a> <a>a2</a> <a>a3</a> </Y> </X> But the following XML document would be assessed as 'valid', when validated by the same schema above, <X> <S1> <a>a1</a> <a>a1</a> <a>a3</a> </S1> <Y> <a>a1</a> <a>a2</a> <a>a3</a> </Y> </X> (since now the element "S1" is substituted for first "Y", but identity constraints of substitution group HEAD are not enforced) On Mon, Jun 18, 2012 at 10:14 PM, Costello, Roger L. <costello@mitre.org> wrote: > Hi Mukul, > > I agree with your analysis. > > In section 2.2.4.4 of the Structures specification it says: > > ... elements substitutable for E are required to > have types derived from T, but are not required > to enforce the identity constraints ... of E. > > Is it possible to construct an element that has identity constraints and has substitutable elements, and the identity constraints are not enforced on the substitution elements? > > If not, what is the point of that statement in the specification? > > /Roger > -- Regards, Mukul Gandhi
Received on Tuesday, 19 June 2012 20:17:34 UTC