At least one child

Discussion in 'XML' started by pawel.pabich@gmail.com, Oct 4, 2005.

  1. Guest

    Hajo,

    Example of XML:
    <root>
    <a/>
    <b/>
    <c/>
    </root>

    I need to ensure that one of a/b/c tags is present
    and every of them can appear only once and they can
    appear in any order.

    any idea?

    thanks in advance for info

    Pawel
     
    , Oct 4, 2005
    #1
    1. Advertising

  2. Guest

    One more thing. _at_least_ one of a/b/c tags has to be present.

    Pawel
     
    , Oct 4, 2005
    #2
    1. Advertising

  3. Harrie Guest

    said the following on 2005-10-04 12:56 +0200:

    > I need to ensure that one of a/b/c tags is present


    Are you talking about a Schema (DTD, XSD) or something else?

    > and every of them can appear only once and they can
    > appear in any order.


    If they may only apear once, how can they appear in any order?

    --
    Regards
    Harrie
     
    Harrie, Oct 4, 2005
    #3
  4. Guest

    Hajo,

    Soory, I am talking about schema.

    Every tag can appear once, it means that following are valid:

    <root>
    <a/>
    <b/>
    </root>

    <root>
    <c/>
    <b/>
    </root>

    but at least one of them has to be present.


    Pawel
     
    , Oct 4, 2005
    #4
  5. <xs:all>
    <xs:element name="a" minOccurs="0"/>
    <xs:element name="b" minOccurs="0"/>
    <xs:element name="c" minOccurs="0"/>
    </xs:all>

    will get you most, but not all, of what you want -- W3C XML Schema has
    no way to express the "at least one of them must be present"
    constraint.

    ht
    --
    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, Oct 6, 2005
    #5
  6. Guest

    Thanks

    Pawel
     
    , Oct 6, 2005
    #6
    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. davout
    Replies:
    0
    Views:
    554
    davout
    Apr 18, 2004
  2. Jeff Rodriguez
    Replies:
    23
    Views:
    1,141
    David Schwartz
    Dec 9, 2003
  3. Mukul Gandhi
    Replies:
    0
    Views:
    508
    Mukul Gandhi
    Oct 3, 2008
  4. Martin Honnen
    Replies:
    0
    Views:
    375
    Martin Honnen
    Oct 3, 2008
  5. AAaron123
    Replies:
    0
    Views:
    604
    AAaron123
    Oct 3, 2008
Loading...

Share This Page