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. Advertisements

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. Michael
    Replies:
    0
    Views:
    630
    Michael
    Sep 16, 2003
  2. Matt Garman
    Replies:
    1
    Views:
    860
    Matt Garman
    Apr 25, 2004
  3. Soren Kuula
    Replies:
    2
    Views:
    812
    Henry S. Thompson
    Dec 1, 2005
  4. Peter Dunker

    union in struct without union name

    Peter Dunker, Apr 26, 2004, in forum: C Programming
    Replies:
    2
    Views:
    1,262
    Chris Torek
    Apr 26, 2004
  5. vj
    Replies:
    0
    Views:
    350
  6. ramu
    Replies:
    2
    Views:
    566
    rlblaster
    Feb 20, 2006
  7. Alfredo Di Napoli
    Replies:
    4
    Views:
    567
    Alfredo Di Napoli
    Feb 19, 2012
  8. Gary Roach
    Replies:
    0
    Views:
    250
    Gary Roach
    Sep 1, 2013
Loading...