Union like mechanism for complex data types?

Discussion in 'XML' started by Andrey Brozhko, Dec 21, 2004.

  1. Hi

    The situation:

    XML document can be either

    <?xml version="1.0" encoding="UTF-8"?>
    <test>
    <item>1</item>
    <item>2</item>
    </test>


    or

    <?xml version="1.0" encoding="UTF-8"?>
    <test>testKeyWord</test>


    So I have two types defined:

    <xs:complexType name="IntegerArray">
    <xs:sequence>
    <xs:element name="item" type="types:IntegerType"/>
    </xs:sequence>
    </xs:complexType>

    and the second type:

    <xs:simpleType name="KeyWord">
    <xs:restriction base="xs:string">
    <xs:enumeration value="testKeyWord"/>
    <xs:enumeration value="testKeyWord2"/>
    </xs:restriction>
    </xs:simpleType>

    Is there any way I can 'merge' lexical spaces of these types together
    (similar to what union does for simple types)? If not, what's the
    correct way to describe the content of my xml document?

    Thanks
    Andrey
     
    Andrey Brozhko, Dec 21, 2004
    #1
    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. Matt Garman
    Replies:
    1
    Views:
    691
    Matt Garman
    Apr 25, 2004
  2. Soren Kuula
    Replies:
    2
    Views:
    617
    Henry S. Thompson
    Dec 1, 2005
  3. Peter Dunker

    union in struct without union name

    Peter Dunker, Apr 26, 2004, in forum: C Programming
    Replies:
    2
    Views:
    928
    Chris Torek
    Apr 26, 2004
  4. vj
    Replies:
    0
    Views:
    287
  5. Alfredo Di Napoli
    Replies:
    4
    Views:
    413
    Alfredo Di Napoli
    Feb 19, 2012
Loading...

Share This Page