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

Re: complexType derivation method

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 10 Jan 2002 11:55:01 +0000
To: "Lemmin, Harald" <Harald.Lemmin@softwareag.com>
Cc: xmlschema-dev@w3.org
Message-ID: <f5bvgea2zfu.fsf@cogsci.ed.ac.uk>
"Lemmin, Harald" <Harald.Lemmin@softwareag.com> writes:

> The example from ht was:
> 
> <xs:complexType name="t1">
>    <xs:simpleContent>                                       
>         <xs:extension base="xs:string">                     
>             <xs:attribute name="x" type="xs:integer"/>      
>         </xs:extension>                                     
>     </xs:simpleContent>                                     
> </xs:complexType>                                           
> 
> <xs:complexType name="t4">                    
>    <xs:simpleContent>                          
>       <xs:restriction base="t1" >             
>          <xs:simpleType>                       
>             <xs:restriction base="xs:token">
>              <xs:pattern value=".*a.*"/>
>             </xs:restriction>
>          </xs:simpleType>
>       </xs:restriction>
>    </xs:simpleContent>
> </xs:complexType>
> 
> So what does type t4 expresses? Is it:
> - t4 permits the attribute with name "x" (as inherited from t1)

Yes.

> - The content of t4 can be of type xs:token and has to match the pattern.

Yes.

>   Is this a valid restriction to the base of t1, because token restricts
> string and pattern is 
>   a valid restriction of the value space?

Yes.

> What confuses me is the local usage of the simpleType and the introduction
> of a new base type.

Since the base type def is really _two_ type defs (the complex one
itself, and the simple one it has for its content) you need two type
definition references: one to the base complex type def, and one to
the simple type def which restricts the base complex type def's
content type.  The outer restriction carries the former, and also may
contain restricting attribute declarations.  The inner simple type and
its restriction are for the latter.

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 Thursday, 10 January 2002 06:55:04 GMT

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