W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2003

Problem with types derived from mixed complex types

From: by way of <achille@us.ibm.com>
Date: Sun, 12 Jan 2003 14:10:41 -0700
Message-Id: <>
To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>

It seems that there is no way to restrict a complex type whose content type
is mixed and allows some elements into a new type  which would simply allow
Here is an example - taken from a SQC issue reported by Paul Biron - that
illustrates the problem :
       <xs:complexType name='base' mixed='true'>
             <xs:choice minOccurs='0' maxOccurs='unbounded'>
                   <xs:element name='e1' type=xs:string'/>
             <xs:attribute name='a1'/>
       <!-- the intend of  this type  is to simply remove all the children
to leave a type which ony allows (untyped) text -->
       <xs:complexType name='restr' mixed='true'>
                   <xs:restriction base='base'>
                         <xs:attribute name='a1'/>

According to the rule below defined in Part 1 section 3.4.2 and specifying
how the content type of a complex type should be computed from its XML
representation,  the content type of restr is EMPTY, not mixed.
"The appropriate case among the following:
1 If the <restriction> alternative is chosen, then the appropriate case
among the following:
1.1 If one of the following is true
1.1.1 There is no <group>, <all>, <choice> or <sequence> among the
1.1.2 There is an <all> or <sequence> among the [children] with no
[children] of its own excluding <annotation>;
1.1.3 There is a <choice> among the [children] with no [children] of its
own excluding <annotation> whose minOccurs [attribute] has the ·actual
value· 0;
, then empty;"

This rule simply ignores the value of mixed attribute, and produces a
result that is counter intuitive.

I thought that another way to remove all the children and allow only text
would be to use <simpleContent>, but, in that case, the spec requires the
base type to be  either to a simple type or a complex type whose content
type is a simple type.  I don't see how to restrict  the base type to allow
only text.  If the rule in section 3.4.2 could be modified to take into
account the value of the mixed attribute, the problem I'm raising would be

Best regards,
Achille Fokoue
XML/XSL Transformational Systems
IBM T.J. Watson Research Center
Received on Sunday, 12 January 2003 16:12:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:59 UTC