Mixed content models and derivation

Hi,

Wanting to test my reading of the rec regarding the interaction of mixed 
content models and derivations by restriction and extension, I have 
tested a simple document (always the same) some of the combination of 
schemas and I must say I find it both confusing since the expected 
behavior from my reading of the rec is not coherent with the "natural" 
meaning given to the words "restriction" and "extension" and disturbing 
since it's showing a wild disparity in the understanding of the rec 
between the 3 schema processors I have tested!

The results can be sumarized by the following tables in which the lines 
"excepted" is my expectation from my reading of the spec and "natural" 
is my expectation from my understanding the words "restriction" and 
"extension":

Derivation by extension:

Base type |     Not mixed      |       Mixed       |
Derived   |   mixed  |not mixed| mixed  | not mixed|
schemas   |   1      |   2     |   3    |    4     |
XML Spy   | ins err  | ins err |  valid |  valid   |
XSV       | valid    | ins err |  valid |ins err[2]|
xerces    |sch err[1]| ins err |  valid |sch err[1]|
expected  | valid    | ins err |  valid | ins err  |
natural   | valid    | ins err |  valid |  valid   |

Derivation by restriction:

Base type |     Not mixed      |       Mixed       |
Derived   |   mixed  |not mixed|  mixed | not mixed|
schemas   |   5      |   6     |   7    |    8     |
XML Spy   | ins err  | ins err | ins err| ins err  |
XSV       | valid    | ins err |  valid | ins err  |
xerces    | valid    | ins err |  valid | ins err  |
expected  | valid    | ins err |  valid | ins err  |
natural   | sch err  | ins err |  valid | ins err  |

XSV seems to be the only processor treating correctly a case which is 
rather trivial!

Thanks for your comments.

Eric

PS: should I submit this kind of tests to the W3C XML Schema test 
taskforce or has this been already covered hundreds of time?

Instance document:

<?xml version="1.0" encoding="UTF-8"?>
<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="{path to schema}">
text
<bar/>
</foo>

Errors:
[1]: [Error] mixed.xml:2:121: Schema error: Anonymous complexType: 
cos-ct-extends.1.4.2.2.2.1: The content type of the base type base and 
derived type #AnonType_foo must both be mixed or element-only.

[2]: <xsv docElt='{None}foo' instanceAssessed='true' instanceErrors='1' 
rootType='[Anonymous]' schemaErrors='0' schemaLocs='None -> 
extension-mixed-undef.xsd' target='mixed.xml' validation='strict' 
version='XSV 1.203/1.108 of 2001/09/24 12:34:23' 
xmlns='http://www.w3.org/2000/05/xsv'>
<schemaDocAttempt URI='extension-mixed-undef.xsd' outcome='success' 
source='schemaLoc'/>
<invalid char='39' code='cvc-complex-type.1.2.3' line='1' 
resource=mixed.xml'>text not allowed: |
	text
	|</invalid>
</xsv>


Schemas:

1:


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="base">
<xs:sequence>
<xs:element name="bar" minOccurs="0" maxOccurs="unbounded" 
type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="foo">
<xs:complexType mixed="true">
<xs:complexContent  mixed="true">
<xs:extension base="base">
<xs:sequence>
<xs:element name="bar2" minOccurs="0" maxOccurs="unbounded" 
type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

2:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="base">
<xs:sequence>
<xs:element name="bar" minOccurs="0" maxOccurs="unbounded" 
type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="foo">
<xs:complexType >
<xs:complexContent  >
<xs:extension base="base">
<xs:sequence>
<xs:element name="bar2" minOccurs="0" maxOccurs="unbounded" 
type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

3

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="base" mixed="true">
<xs:sequence>
<xs:element name="bar" minOccurs="0" maxOccurs="unbounded" 
type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="foo">
<xs:complexType mixed="true">
<xs:complexContent>
<xs:extension base="base">
<xs:sequence>
<xs:element name="bar2" minOccurs="0" maxOccurs="unbounded" 
type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

4

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="base" mixed="true">
<xs:sequence>
<xs:element name="bar" minOccurs="0" maxOccurs="unbounded" 
type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="foo">
<xs:complexType>
<xs:complexContent>
<xs:extension base="base">
<xs:sequence>
<xs:element name="bar2" minOccurs="0" maxOccurs="unbounded" 
type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

5:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="base" >
<xs:sequence>
<xs:element name="bar" type="xs:string" minOccurs="0" 
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="foo">
<xs:complexType mixed="true">
<xs:complexContent mixed="true">
<xs:restriction base="base">
<xs:sequence>
<xs:element name="bar" type="xs:string" minOccurs="0" 
maxOccurs="unbounded"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

6:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="base" >
<xs:sequence>
<xs:element name="bar" type="xs:string" minOccurs="0" 
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="foo">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="base">
<xs:sequence>
<xs:element name="bar" type="xs:string" minOccurs="0" 
maxOccurs="unbounded"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

7:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="base" >
<xs:sequence>
<xs:element name="bar" type="xs:string" minOccurs="0" 
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="foo">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="base">
<xs:sequence>
<xs:element name="bar" type="xs:string" minOccurs="0" 
maxOccurs="unbounded"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

8:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="base" mixed="true">
<xs:sequence>
<xs:element name="bar" type="xs:string" minOccurs="0" 
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="foo">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="base">
<xs:sequence>
<xs:element name="bar" type="xs:string" minOccurs="0" 
maxOccurs="unbounded"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>


-- 
Rendez-vous à Paris pour une visite guidee de la nebuleuse XML.
                                           http://dyomedea.com/formation/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------

Received on Sunday, 14 October 2001 07:44:22 UTC