W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2001

Re: constraining an element to be either simple or complex content

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 19 Oct 2001 17:44:00 +0100
Message-ID: <13025674047.20011019174400@jenitennison.com>
To: "Priscilla Walmsley" <priscilla@walmsley.com>
CC: xmlschema-dev@w3.org
Hi Priscilla,

> You can't extend simple content to create complex content, but you
> _can_ restrict mixed complex content to create simple content. In
> this situation, you would define the types as:
> <xs:complexType name="baseType" mixed="true" abstract="true">
>   <xs:sequence>
>     <xs:any minOccurs="0" maxOccurs="unbounded"/>
>   </xs:sequence>
> </xs:complexType>
> <xs:complexType name="simpleType">
>   <xs:simpleContent>
>     <xs:restriction base="baseType">
>       <xs:simpleType>
>         <xs:restriction base="xs:integer"/>
>       </xs:simpleType>
>     </xs:restriction>
>   </xs:simpleContent>
> </xs:complexType>

Wow, that is obscure! It works in XSV, but I'm confused about why,
because Clause 2 of the Complex Type Definition Representation OK
Schema Representation Constraint says:

  2 If the <simpleContent> alternative is chosen, the type
    definition ·resolved· to by the ·actual value· of the base
    [attribute] must be either a complex type definition whose
    {content type} is a simple type definition or, only if the
    <extension> alternative is also chosen, a simple type definition;

but the base attribute in the definition of the 'simpleType' type is a
complex type definition whose {content type} is a *complex* type
definition, isn't it?
Or am I reading it wrong?



Jeni Tennison
Received on Friday, 19 October 2001 12:44:03 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:53 UTC