Re: [Moderator Action] complexType / simpleContent / restriction vs extension

"Mark Young" <mark@kamiak.com> writes:

> In section 4.3.3 of "XML Schema Part 1..." restriction has
> simpleType as one of its allowed content items, while extension does
> not (this under complexType / simpleContent).  This seems
> inconsistent; why is it allowed for restriction but not for
> extension?

You can never extend a simpleType with another simpleType -- this
would mean some kind of concatenation, I guess, and we've never chosen 
to support this.  This is true for both ordinary simple types, and
complex types with simple content.  What had you thought e.g.

<xs:complexType>
 <xs:simpleContent>
  <xs:extension base="xs:string">
   <xs:simpleType>
     <xs:restriction base="xs:integer"/>
   </xs:simpleType>
  </xs:extension>
 </xs:simpleContent>
<xs:complexType>

would mean?

> Also, I don't believe that the normative schema schema has this for
> complexType/simpleContent/restriction (i.e. no simpleType in the
> content).

Here is the type definition for <extension> when it appears inside
<simpleContent>:

 <complexType name="simpleExtensionType">
  <complexContent>
   <restriction base="extensionType">
    <sequence>
     <annotation>
      <documentation xml:lang="en">
      No typeDefParticle group reference</documentation>
     </annotation>
     <element ref="annotation" minOccurs="0"/>
     <group ref="attrDecls"/>
    </sequence>
   </restriction>
  </complexContent>
 </complexType>

As you can see, it does _not_ allow <simpleType>, but only attribute
declarations.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Wednesday, 10 January 2001 04:03:13 UTC