logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Mixed content woes (: msg#00070

Subject: Mixed content woes (

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




<Prev in Thread] Current Thread [Next in Thread>