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

Re: Mixed content woes (

From: Francis Brouns <francis.brouns@ou.nl>
Date: Tue, 19 Nov 2002 15:54:16 +0100
Message-ID: <000b01c28fdb$883f3a10$91b01491@otecdev.pwo.ou.nl>
To: <xmlschema-dev@w3.org>

Hello,

> Are you sure?  Note that your declaration only allows _one_ of a, b or
> c inside x.  Please send sample instance doc't and XSV error message.
>

Well, I am sure that XSV reports an error. I am not sure whether my model is
correct. In the DTD the model is <!ELEMENT x (#PCDATA | a | b | c)*. This
should be transformed to the corresponding xml schema complex type. As far
as I know, the * is required for mixed content models in a DTD. This
particular instance should specify that x contains either #pcdata, or a, or
b, or c. Maybe I have to specify a minOccurs on the choice compositor??



Below are the schema and relevant documents

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
 <xs:element name="x" type="xtype"/>
 <xs:complexType name="xtype" mixed="true">
  <xs:choice>
   <xs:element ref="a"/>
   <xs:element ref="b"/>
   <xs:element ref="c"/>
  </xs:choice>
 </xs:complexType>
 <xs:element name="a" type="xs:string"/>
 <xs:element name="b" type="btype"/>
 <xs:element name="c">
  <xs:complexType>
   <xs:attributeGroup ref="attr.ref"/>
  </xs:complexType>
 </xs:element>
 <xs:attributeGroup name="attr.ref">
  <xs:attribute name="ref" use="required"/>
 </xs:attributeGroup>
 <xs:complexType name="btype">
  <xs:choice>
   <xs:element name="k"/>
   <xs:element name="l"/>
   <xs:element name="m"/>
   <xs:element name="n"/>
   <xs:element name="o"/>
  </xs:choice>
 </xs:complexType>
</xs:schema>

<?xml version="1.0" encoding="UTF-8"?>
<z xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Document.xsd">
 <y ref="refid"/>
 <x>Text</x>
</z>

<xsv xmlns='http://www.w3.org/2000/05/xsv' docElt="{None}z"
     instanceAssessed="true" instanceErrors="1" schemaErrors="0"
     schemaLocs="None -> Document.xsd; None -> Document.xsd"
     target="file:/C:/fbr/untitled5.xml" validation="lax"
     version="XSV 2.0-3 of 2002/11/08 15:08:04">
  <schemaDocAttempt URI="file:/C:/fbr/Document.xsd" outcome="success"
                    source="schemaLoc"/>
  <schemaDocAttempt URI="file:/C:/fbr/Document.xsd" outcome="redundant"
                    source="schemaLoc"/>
  <invalid char="9" code="cvc-complex-type.1.2.4" line="5"
           resource="file:/C:/fbr/untitled5.xml">
    content of x is not allowed to end here (1), expecting
[&apos;{None}:c&apos;
, &apos;{None}:a&apos;, &apos;{None}:b&apos;]:

    <fsm>
      <node id="1">
        <edge dest="2" label="{None}:a"/>
        <edge dest="2" label="{None}:b"/>
        <edge dest="2" label="{None}:c"/>
      </node>
      <node final="true" id="2"/>
    </fsm>
  </invalid>
</xsv>
Received on Tuesday, 19 November 2002 09:53:01 GMT

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