W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2001

question about unique and xpath

From: Uwe Zeise <uwezeise@yahoo.de>
Date: Thu, 24 May 2001 13:11:32 +0200
Message-ID: <001401c0e442$4afc5840$51b450d9@compaq>
To: <www-xml-schema-comments@w3.org>
Hi folks,

How can I achieve via "unique" that the element "id" is unique within the whole document ?

<root>
  
 <postition>
    <id>100</id>
  </postition>
  <postion>
    <id>101</id>
  </postion>
 
  <anotherpostion>
    <dummy>
      <id>102</id>
    </dummy>
  </anotherposition>

</root>
     
XML-Schema:

<element name="root">
  <complexType>
    <sequence>
      <element name="postion" maxOccurs="unbounded">
        <complexType>
          <sequence>
            <element name="id" type="positiveInteger"/>
          </sequence>
        </complexType>
      </element>
      <element name="anotherposition" maxOccurs="unbounded">
        <complexType>
          <sequence>
            <element name="dummy">
              <complexType>
                <sequence>
                  <element name="id" type="positiveInteger"/>
                </sequence>
              </complexType>
            </element>
          </sequence>
         </complexType>
        </element>
      </sequence>
    </complexType>
    <unique name="idMustBeUnique">
      <selector xpath=".//id"/>                       <------------- Is that one correct ?
      <field       xpath="."/>
    </unique>
  </element>

  Thanks in advance for an answer,

  Regards, Uwe.


  



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Received on Thursday, 24 May 2001 07:11:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:50 GMT