W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2003

Can field be simpleContent in identity constraint?

From: Rainer Becker <rainerbecker.mail@t-online.de>
Date: Thu, 06 Feb 2003 22:51:19 +0100
Message-ID: <3E42D8D7.91D565C@t-online.de>
To: xmlschema-dev@w3.org

Hello newsgroup readers,

this question is about identity constraints. The Spec says

3.11.4 Identity-constraint Definition Validation Rules
Validation Rule: Identity-constraint Satisfied
........

4 [Definition:]  Call the subset of the Ětarget node setĚ
for which all the {fields} evaluate to a node-set with
exactly one member which is an element or attribute node
with a simple type the qualified node set.

That means, that a field can either be an attribute or
a simple type element. But the following instance validates
just fine in XSV, XMLSPY5, and MSXML, although the field is
a simple content element. Does the above definition include
simpleContent? Please clarify...

Thank you

Bis bald

Rainer


XML
####

<Liste xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="T.xsd">
   <Buch>
      <ID>1</ID>
      <Name>Buch1</Name>
   </Buch>
   <Buch>
      <ID>2</ID>
      <Name>Buch2</Name>
   </Buch>
</Liste>

XSD
###

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:element name="Liste">
      <xs:complexType>
         <xs:sequence>
            <xs:element ref="Buch" maxOccurs="unbounded" />
         </xs:sequence>
      </xs:complexType>

      <xs:unique name="UNIQUE_Buch">
         <xs:selector xpath=".//Buch" />
         <xs:field xpath=".//ID" />
      </xs:unique>

   </xs:element>

   <xs:element name="Buch">
      <xs:complexType>
         <xs:sequence>
            <xs:element ref="ID" />
            <xs:element name="Name" type="xs:string" />
         </xs:sequence>
      </xs:complexType>
   </xs:element>

   <xs:element name="ID">
      <xs:complexType>
         <xs:simpleContent>
            <xs:extension base="xs:integer">
               <xs:attribute name="test" type="xs:string" use="optional"
/>
            </xs:extension>
         </xs:simpleContent>
      </xs:complexType>
   </xs:element>

</xs:schema>
Received on Thursday, 6 February 2003 16:48:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT