XML W3C Schema, check excistence of attribute depending on otherattributes

Discussion in 'XML' started by RolfK, Aug 30, 2008.

  1. RolfK

    RolfK Guest

    Dear ALL,

    I creating an XML which holds elements which optional attributes.
    So-far no problem, I just set the "optional" value in the "required"
    attribute of my schema.
    But how to check for such situations (I omitted the attribute values
    for the sake of short text here)

    A1 is always there, all other attributes are optional.

    Case one:
    Combination which may exists are A1,AA2,A3 or A1,A4,A5.
    <E A1="" A2="" A3="">
    <E A1="" A4"" A5="">

    Case two:
    The existance of an attribute depnds on a the VALUE of another
    attribute
    A1=a ==> A1,A2,A3
    A1=b ==> A1,A4,A5
    A1=c ==> A1,A6,A7

    <E A1="a" A2="" A3="">
    <E A1="b" A4="" A5="">
    <E A1="c" A6="" A7="">

    May be there is a standard solution for this two cases.
    Thanks a lot
    Rolfk
     
    RolfK, Aug 30, 2008
    #1
    1. Advertising

  2. RolfK wrote:

    > Case one:
    > Combination which may exists are A1,AA2,A3 or A1,A4,A5.
    > <E A1="" A2="" A3="">
    > <E A1="" A4"" A5="">
    >
    > Case two:
    > The existance of an attribute depnds on a the VALUE of another
    > attribute
    > A1=a ==> A1,A2,A3
    > A1=b ==> A1,A4,A5
    > A1=c ==> A1,A6,A7


    I don't think such restrictions can be modelled with the W3C XML schema
    language.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Aug 30, 2008
    #2
    1. Advertising

  3. RolfK

    Guest

    On 30 Aug, 12:26, Martin Honnen <> wrote:
    > RolfK wrote:
    > > Case one:
    > > Combination which may exists are A1,AA2,A3 or A1,A4,A5.
    > > <E A1="" A2="" A3="">
    > > <E A1=""  A4"" A5="">

    >
    > > Case two:
    > > The existance of an attribute depnds on a the VALUE of another
    > > attribute
    > > A1=a ==> A1,A2,A3
    > > A1=b ==> A1,A4,A5
    > > A1=c ==> A1,A6,A7

    >
    > I don't think such restrictions can be modelled with the W3C XML schema
    > language.
    >
    > --
    >
    >         Martin Honnen
    >        http://JavaScript.FAQTs.com/


    I agree Martin. People recommend using things like Schematron or
    Relax-NG for this type of thing.

    FWIW XSD 1.1 looks like it will include functionality for this sort of
    thing in the way of schematron like assertions (xs:assert). For those
    interested last call for the current draft of XSD 1.1 ends this Friday
    12th Sept! How long it will take before you can assume the additional
    functionality is in your tools is anyones guess!

    HTH,

    Pete Cordell
    Codalogic Ltd
    Interface XML to C++ the easy way using XML C++
    data binding to convert XSD schemas to C++ classes.
    Visit http://www.codalogic.com/lmx/ for more info
     
    , Sep 10, 2008
    #3
    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. Frank
    Replies:
    9
    Views:
    1,573
    David Dorward
    May 3, 2004
  2. Ingrid
    Replies:
    0
    Views:
    409
    Ingrid
    Aug 3, 2004
  3. Steve Jorgensen
    Replies:
    0
    Views:
    561
    Steve Jorgensen
    Aug 9, 2005
  4. Replies:
    1
    Views:
    373
  5. Manuel Collado
    Replies:
    6
    Views:
    1,418
    Manuel Collado
    Oct 20, 2011
Loading...

Share This Page