xsd definition

Discussion in 'XML' started by Sandy, Aug 2, 2005.

  1. Sandy

    Sandy Guest

    Hi,

    I want to write one element definition which can contain any number of "A"
    or "B" subelements in the XML file in any order.
    e.g. the following xml should be allowed

    <rootelement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="file.xsd">
    <A/>
    <A/>
    <B/>
    <A/>
    <B/>
    <B/>
    </rootelement>

    How do i write a .xsd to validate this form of XML

    <xs:element name="rootelement">
    <xs:complexType>
    <xs:????? minOccurs="0" maxOccurs="unbounded">
    <xs:element ref="A"/>
    <xs:element ref="B"/>
    </xs:?????>
    </xs:complexType>
    </xs:element>
    Sandy, Aug 2, 2005
    #1
    1. Advertising

  2. Sandy

    commercial Guest

    It depends on who validates.

    Do you sign a contract ?

    Do you use your or the other party's scheme.

    -------------------------------------------------------------------

    Simply, I dont understand your mental bottleneck.




    "Sandy" <> wrote in message news:dcn3sa$...
    > Hi,
    >
    > I want to write one element definition which can contain any number of "A"
    > or "B" subelements in the XML file in any order.
    > e.g. the following xml should be allowed
    >
    > <rootelement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > xsi:noNamespaceSchemaLocation="file.xsd">
    > <A/>
    > <A/>
    > <B/>
    > <A/>
    > <B/>
    > <B/>
    > </rootelement>
    >
    > How do i write a .xsd to validate this form of XML
    >
    > <xs:element name="rootelement">
    > <xs:complexType>
    > <xs:????? minOccurs="0" maxOccurs="unbounded">
    > <xs:element ref="A"/>
    > <xs:element ref="B"/>
    > </xs:?????>
    > </xs:complexType>
    > </xs:element>
    >
    >
    commercial, Aug 2, 2005
    #2
    1. Advertising

  3. Sandy

    Guest

    Sandy a écrit :

    > Hi,
    >
    > I want to write one element definition which can contain any number of "A"
    > or "B" subelements in the XML file in any order.
    > e.g. the following xml should be allowed
    >
    > <rootelement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > xsi:noNamespaceSchemaLocation="file.xsd">
    > <A/>
    > <A/>
    > <B/>
    > <A/>
    > <B/>
    > <B/>
    > </rootelement>
    >
    > How do i write a .xsd to validate this form of XML
    >
    > <xs:element name="rootelement">
    > <xs:complexType>
    > <xs:????? minOccurs="0" maxOccurs="unbounded">
    > <xs:element ref="A"/>
    > <xs:element ref="B"/>
    > </xs:?????>
    > </xs:complexType>
    > </xs:element>

    Have a look here:
    http://www.w3schools.com/schema/default.asp
    , Aug 2, 2005
    #3
  4. Priscilla Walmsley, Aug 2, 2005
    #4
  5. Sandy

    Sandy Guest

    Thanks,
    It worked :)


    "Priscilla Walmsley" <> wrote in message
    news:X3JHe.10$...
    > Use xs:choice.
    >
    > Hope that helps,
    > Priscilla
    >
    > ----------------------------------
    > Priscilla Walmsley
    > Author, Definitive XML Schema
    > http://www.datypic.com
    > ----------------------------------
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    Sandy, Aug 2, 2005
    #5
    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,070
    Markus
    Nov 22, 2005
  2. Rick Razzano

    XSD document for XSD defintion

    Rick Razzano, Sep 26, 2003, in forum: XML
    Replies:
    1
    Views:
    457
    C. M. Sperberg-McQueen
    Sep 26, 2003
  3. Replies:
    1
    Views:
    837
    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:
    763
    Peter Aberline
    Apr 5, 2004
  5. Bernd Oninger
    Replies:
    1
    Views:
    511
    Henry S. Thompson
    Jun 30, 2004
Loading...

Share This Page