W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2005

schema design for one element, multiple types

From: Kevin Y. Kim (Lists) <kykim_lists@mac.com>
Date: Tue, 8 Nov 2005 23:18:26 -0500
Message-Id: <eadc00f38bc01ef95aa29925a33f1091@mac.com>
To: xmlschema-dev@w3.org

Hi,

I'm trying to define a schema that will support the following:

1    <some_xml>
2        <foo>some_value</foo>
3        <foo>
4            <bar>another_value</bar>
5        <foo>
6        <foo>third_value</foo>
7    </some_xml>

Now, I know how to defined the schema for each case:
     For 2 & 6:
         <xsd:complexType name="foo1">
             <xsd:simpleContent>
                 <xsd:extension type="xsd:string"/>
             </xsd:simpleContent>
         </xsd:complexType>

	For 3 - 5:
         <xsd:complexType name="foo2">
             <xsd:sequence>
                 <xsd:element name="bar" type="xsd:string"/>
             </xsd:sequence>
         </xsd:complexType>

But how would I defined a schema to encompass both?

Thanks,
-kevin
Received on Wednesday, 9 November 2005 05:26:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:51 GMT