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

Mixed content woes (

From: Stuart Brown <sepenidur@hotmail.com>
Date: Mon, 18 Nov 2002 13:04:18 +0000
To: xmlschema-dev@w3.org
Message-ID: <F118rCPnhFXP5UYhNMF00013476@hotmail.com>

Hi,

I'm newish to XSD, and am having some trouble with converting DTD mixed 
content element into mixed complex types that reference groups. Having 
tracked through the archives I'm kind of getting an idea of the problem, but 
I'm still stuck as to a solution.

Say I had a DTD fragment like so:

<!ENTITY % foo "a | b | c">
<!ELEMENT z (#PCDATA | %foo; | d)*>

and for argument's sake a, b, c are PCDATA only and d implements a defined 
complex type.

The datatype of (PCDATA | %foo | d) reoccurs in other elements, as does %foo 
alone, so I have designed the schema equivalent as follows:

<xsd:group name="foo">
<xsd:choice>
  <xsd:element name="a" type="xsd:string"/>
  <xsd:element name="b" type="xsd:string"/>
  <xsd:element name="c" type="xsd:string"/>
</xsd:choice>
</xsd:group>
<xsd:complexType name="dType">
<!-- etc... -->
</xsd:complexType>
<xsd:complexType name="zType" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
  <xsd:group ref="foo"/>
  <xsd:element name="d" type="dType"/>
</xsd:choice>
</xsd:complexType>
<xsd:element name="z" type="zType"/>

The problem occurs when I attempt to validate with this. If I have the data:

<z>Confusion now <a>hath</a><!-- or any of b, c , or d --> made its 
masterpiece.</z>

Then all string data after the first occurrence of a child element is 
rejected (by XMLSpy) with the message: Text not allowed inside element "

Defining all the elements directly within the zType complex type works fine, 
but I would rather construct the model using group fragments.

Any advice on how I can reference group/choice fragments in a mixed content 
complex type?

Thanks in advance,

Stuart

======









_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus
Received on Monday, 18 November 2002 08:32:57 GMT

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