W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2001

Choosing Between ComplexTypes

From: Sean B. Palmer <sean@mysterylights.com>
Date: Mon, 2 Jul 2001 18:00:45 +0100
Message-ID: <027e01c10318$a76cac20$dcd993c3@z5n9x1>
To: <xmlschema-dev@w3.org>
I want to be able to express a very general element type:-

   <!ELEMENT a ( b | ( c | #PCDATA )* ) >

Which can later be extended/restricted, but because to allow for
"#PCDATA" you have to specify mixed="true" on the <complexType>, I've
no idea how to do this using XML Schema. In other words, I aim for
"<a><b/></a>" and "<a><c/>text</a>" to be legal, but for
"<a><b/>text</a>" not to be.

I have:-

<xsd:element name="a">
   <xsd:complexType>
     <xsd:choice>
       <xsd:element ref="b"/>
       <xsd:group ref="c.grp"/>
     </xsd:choice>
   </xsd:complexType>
</xsd:element>

<xsd:group name="c.grp">
   <xsd:choice minOccurs="0" maxOccurs="unbounded">
     <xsd:element ref="c"/>
   </xsd:choice>
</xsd:group>

But as you can't put mixed="true" on a group, I'm stuck. Could
somebody help me, please?

--
Kindest Regards,
Sean B. Palmer
@prefix : <http://webns.net/roughterms/> .
:Sean :hasHomepage <http://purl.org/net/sbp/> .
Received on Monday, 2 July 2001 12:59:53 GMT

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