Undefined elements XSD definition

Discussion in 'XML' started by oziris, Nov 24, 2005.

  1. oziris

    oziris Guest

    hi !

    I would like to write a schema for this kind of XML document

    <request>
    <params>
    <param1>foo</param1>
    <pouet>foo</pouet>
    <truc>bidule</truc>
    </params>
    <body>
    .....
    </body>
    </request>

    The number and the name of the params are undefined. Another valid XML
    document could be

    <request>
    <params>
    <azerty>foo</azerty>
    <qwerty>foo</qwerty>
    <name>oziris</name>
    </params>
    <body>
    .....
    </body>
    </request>

    Is there a XSD mean to specify that?
    Using <xs:any> was my first idea but I wonder if there is better
    answer.

    Thanks a lot.

    -o--
    oziris, Nov 24, 2005
    #1
    1. Advertising

  2. oziris wrote:


    > <params>
    > <param1>foo</param1>
    > <pouet>foo</pouet>
    > <truc>bidule</truc>
    > </params>


    > The number and the name of the params are undefined.


    > Is there a XSD mean to specify that?
    > Using <xs:any> was my first idea but I wonder if there is better
    > answer.


    You would need xs:any if you don't know the element names.
    But of course you could avoid that with e.g.
    <params>
    <param name="param1" value="foo"</param>
    </params>
    and then define that element param as having two attributes name and
    value as needed.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Nov 24, 2005
    #2
    1. Advertising

  3. oziris writes:

    > The number and the name of the params are undefined.
    >
    > Is there a XSD mean to specify that?
    > Using <xs:any> was my first idea but I wonder if there is better
    > answer.


    That's precisely what xs:any is for.

    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, Nov 24, 2005
    #3
  4. oziris

    oziris Guest

    Thanks a lot Martin.
    So easy I don't understand why I don't find by myself.

    -o--
    oziris, Nov 24, 2005
    #4
    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. Markus
    Replies:
    1
    Views:
    1,083
    Markus
    Nov 22, 2005
  2. Rick Razzano

    XSD document for XSD defintion

    Rick Razzano, Sep 26, 2003, in forum: XML
    Replies:
    1
    Views:
    470
    C. M. Sperberg-McQueen
    Sep 26, 2003
  3. Replies:
    1
    Views:
    848
    Martin Honnen
    Jan 14, 2004
  4. Peter Aberline

    xsd:any as a child of xsd:all

    Peter Aberline, Apr 5, 2004, in forum: XML
    Replies:
    0
    Views:
    775
    Peter Aberline
    Apr 5, 2004
  5. klikic
    Replies:
    2
    Views:
    2,496
    George Bina
    Jan 15, 2007
Loading...

Share This Page