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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.