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

Re: [Moderator Action] Derving complex types by restriction

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 11 Oct 2000 19:48:50 +0100
To: Gino Basso <GBasso@ware2.com>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <f5bbswrb4dp.fsf@cogsci.ed.ac.uk>
Gino Basso <GBasso@ware2.com> writes:

> This is a general question about the spec (nothing to do with any particular
> validator/processor). Does deriving complex types through restriction have
> to be explicit? In other words, does the derived type have to explicitly
> restrict the base type within the definition itself? Or can the restriction
> be implied, say through another derived type? Consider the following
> example:
> 
> <schema targetNamespace="http://www.ware2.com/schema/examples"
>         xmlns="http://www.w3.org/2000/10/XMLSchema"
>         xmlns:eg="http://www.ware2.com/schema/examples">
> 
>     <complexType name="Derived1">
>         <complexContent>
>             <restriction base="eg:Base1">
>                 <sequence>
>                     <element name="element1" type="string" />
>                     <element name="element2" type="eg:lessThan10" />
>                 </sequence>
>             </restriction>
>         </complexContent>
>     </complexType>
>     
>     <complexType name="Derived2">
>         <complexContent>
>             <restriction base="eg:Base1">
>                 <sequence>
>                     <element name="element1" type="string" />
>                     <element name="element2">
>                         <restriction base="positiveInteger">
>                             <maxExclusive value="10" />
>                         </restriction>
>                     </element>
>                 </sequence>
>             </restriction>
>         </complexContent>
>     </complexType>
> 
>     <complexType name="Base1">
>         <sequence>
>             <element name="element1" type="string" />
>             <element name="element2" type="positiveInteger" />
>         </sequence>
>     </complexType>
>     
>     <simpleType name="lessThan10">
>         <restriction base="positiveInteger">
>             <maxExclusive value="10" />
>         </restriction>
>     </simpleType>
>     
> </schema>
> 
> Syntactically both derived types 'Derived1' and 'Derived2' represent the
> same content model, but are both valid?

Yes it has to be explicit, but not necessarily in place, so they are
both OK as far as I can see.

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, 11 October 2000 14:48:53 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:47 UTC