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

coerce mixed/element content to simple content via restriction ?

From: Tom Moog <tmoog@sarvega.com>
Date: Tue, 11 Jun 2002 14:09:19 -0500
Message-ID: <3D064ADF.8B866299@sarvega.com>
CC: xmlschema-dev@w3.org


In a recent book on xml schema there is an example that shows a complex
type with complex content being coerced to simple content because of
an empty restriction plus mixed content.  This looks really odd and seems
to violate the idea that simple content and element content can't appear
in the same derivation hierarchy.

Is this valid ?

The author appears to know that this is unusual because she adds, "This is

the only case where a restriction element may have both a base attribute
and a simpleType child".

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >

<xs:complexType name="BaseType" mixed="true">
   <xs:sequence minOccurs="0">
     <xs:element name="a" type="xs:string" />
  </xs:sequence>
</xs:complexType>

<xs:complexType name="DerivedType" mixed="true">
  <xs:complexContent>
    <xs:restriction base="BaseType">
      <xs:simpleType>
        <xs:restriction base="xs:string" />
      </xs:simpleType>
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>

</xs:schema>
Received on Tuesday, 11 June 2002 15:10:24 GMT

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