force uniqueness with xml schema

Discussion in 'XML' started by Robert Ludewig, Jun 28, 2004.

  1. <LinkList>
    <Link ID="A01" />
    <Link ID="A02" />
    <Link ID="A03" />
    <Link ID="A01" />
    </LinkList>

    How can I specify in a xmlschema that in the linklist are no occurences with
    same ID ?
    (Last Link is illegal)
     
    Robert Ludewig, Jun 28, 2004
    #1
    1. Advertising

  2. Robert Ludewig

    Cat Guest

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    On Mon, 28 Jun 2004 15:18:21 +0200, Robert Ludewig wrote:

    > <LinkList>
    > <Link ID="A01" />
    > <Link ID="A02" />
    > <Link ID="A03" />
    > <Link ID="A01" />
    > </LinkList>
    >
    > How can I specify in a xmlschema that in the linklist are no occurences with
    > same ID ?
    > (Last Link is illegal)

    You can use the xs:ID simple type which won't validate for the above example

    ============= EXAMPLE ===============================

    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="LinkList">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Link" maxOccurs="unbounded">
    <xs:complexType>
    <xs:attribute name="ID" type="xs:ID"/>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>

    </xs:schema>
    - --
    Cat

    http://www.ratrobot.com/writing/ms/ Wanted Java Developer please email your
    resume. Microsoft Word format only. You can't escape Microsoft's empire.
    But will breaking it up be enough?
    Tue Jun 29 20:59:59 UTC 2004
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (GNU/Linux)

    iD8DBQFA4dhPKHRjYtwQ1QARAs+7AKDB084W80AdW/7pAX+Cczj44+Bb5wCdEG5d
    PUVb4vv0uMD8YjyW6MCiU5Y=
    =3IQr
    -----END PGP SIGNATURE-----
     
    Cat, Jun 29, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ognen Ivanovski
    Replies:
    0
    Views:
    963
    Ognen Ivanovski
    Jul 15, 2003
  2. Olaf Meyer

    XML schema uniqueness constraints

    Olaf Meyer, Jan 15, 2004, in forum: XML
    Replies:
    0
    Views:
    518
    Olaf Meyer
    Jan 15, 2004
  3. Victor
    Replies:
    3
    Views:
    1,015
    Martin Honnen
    Feb 6, 2004
  4. Robert Ludewig

    force uniqueness in xml schema

    Robert Ludewig, Jun 28, 2004, in forum: XML
    Replies:
    1
    Views:
    395
    Martin Honnen
    Jun 28, 2004
  5. Adam Gardner
    Replies:
    5
    Views:
    163
    Sebastian Hungerecker
    Nov 19, 2008
Loading...

Share This Page