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

RE: coerce mixed/element content to simple content via restriction ?

From: Priya Lakshminarayanan <priyal@microsoft.com>
Date: Tue, 11 Jun 2002 12:29:07 -0700
Message-ID: <8D7D23D65C1CEB44ABEE89F137A5D32804474631@red-msg-09.redmond.corp.microsoft.com>
To: "Tom Moog" <tmoog@sarvega.com>, <xmlschema-dev@w3.org>
Cc: <xmlschema-dev@w3.org>

I think you meant to show the derivedType as having simpleContent instead of complexContent. 

<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:simpleContent>
    <xs:restriction base="BaseType">
      <xs:simpleType>
        <xs:restriction base="xs:string" />
      </xs:simpleType>
    </xs:restriction>
  </xs:simpleContent>
</xs:complexType>

The above is valid since the baseType's particle is emptiable and its mixed="true", as per clause 5.1.2 of Schema Component Constraint: Derivation Valid (Restriction, Complex)in the XML Schema rec. [http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction]

5 The appropriate case among the following must be true:
5.1 If the {content type} of the complex type definition is a simple type definition, then one of the following must be true:
5.1.1 The {content type} of the {base type definition} must be a simple type definition of which the {content type} is a ·valid restriction· as defined in Derivation Valid (Restriction, Simple) (§3.14.6). 
5.1.2 The {base type definition} must be mixed and have a particle which is ·emptiable· as defined in Particle Emptiable (§3.9.6).

Thanks,
Priya

-----Original Message-----
From: Tom Moog [mailto:tmoog@sarvega.com] 
Sent: Tuesday, June 11, 2002 12:09 PM
To: xmlschema-dev@w3.org
Cc: xmlschema-dev@w3.org
Subject: coerce mixed/element content to simple content via restriction ?



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:29:41 GMT

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