Validation of attributes using XML Schema

Discussion in 'XML' started by =?ISO-8859-1?Q?Patr=EDcia_Martins?=, Apr 28, 2004.

  1. Hi,

    I would like to know if it's possible to validate attributes in a
    situation like this:

    <TUPLE>
    <LIST type="type1">Bla</LIST>
    <LIST type="type2">Ble</LIST>
    <ATOM type="type3">Bli</ATOM>
    </TUPLE>

    I need that the nested elements under <TUPLE> have different values
    for the attribute type, even considering distinct elements. So, I
    can't have a document like this:

    <TUPLE>
    <LIST type="type1">Bla</LIST>
    <LIST type="type1">Ble</LIST> <---- repeated type nested under
    <TUPLE>
    <ATOM type="type3">Bli</ATOM>
    </TUPLE>

    Please, help me !

    Thanks in advance,
    PatrĂ­cia Martins
     
    =?ISO-8859-1?Q?Patr=EDcia_Martins?=, Apr 28, 2004
    #1
    1. Advertising

  2. (PatrĂ­cia Martins) writes:

    > I need that the nested elements under <TUPLE> have different values
    > for the attribute type, even considering distinct elements. So, I
    > can't have a document like this:
    >
    > <TUPLE>
    > <LIST type="type1">Bla</LIST>
    > <LIST type="type1">Ble</LIST> <---- repeated type nested under
    > <TUPLE>
    > <ATOM type="type3">Bli</ATOM>
    > </TUPLE>


    The key and unique identity constraint features of W3C XML Schema
    should do what you want. See the W3C XML Schema Primer [1] for a
    tutorial introduction.

    ht

    [1] http://www.w3.org/TR/2004/PER-xmlschema-0-20040318/#specifyingUniqueness
    --
    Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
     
    Henry S. Thompson, Apr 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.

Share This Page