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

Re: Fw: SimpleType, SimpleContent, Redefine

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Thu, 21 Mar 2002 08:53:07 +0100
Message-ID: <3C999163.4030207@dyomedea.com>
To: Bruno Chatel <bcha@chadocs.net>
Cc: xmlschema-dev@w3.org, patt <pattar@tireme.fr>, bcha@chadocs.com
Bruno Chatel wrote:

>>Not really, simple and complex types are very different beasts (despite 
>>similarities which are IMO exagerated in the W3C Recommendation) and the 
>>kind of derivations which you will be able to do on those types is 
>>different.
> 
> My initial understanding of the difference was that simpleType was used
> for data (i.e. content of leaf nodes) and complexType for "structured" content
> model (including attribute definitions).

Yep, that's what I meant :) ...

> So, it means that the way to decide if I use a simpleType or a complexType for
> defining "unit" is driven by the usage (in term of derivation) of it ? 

It's one of the driving factors, yes.

> And not by the content model it describes ?

The content model does drive it too, you're right, but in the case which 
you've mentioned the datatype used as "interface" was describing a 
simple content complex type without attribute which can also be 
described as a simple type...

> 
> Then imagine that I want to use unit for
> 1- apply a facet (for example maxExclusive) for defining a particular limited unit
> AND
> 2- define a complexType  in an other schema (importing this one) by redefine
> mecanism
> 
> I can't do this because :
> 1- implies to use a simpleType
> 2- implies to use a complexType

You're right and in the general case you may want to provide both 
"interfaces":

In the imported schema:

<xs:simpleType name="unit-s">
   <xs:restriction base="xs:integer">
     <xs:maxInclusive value="100"/>
   </xs:restriction>
</xs:simpleType>

<xs:complexType name="unit-c">
  <xs:simpleContent>
   <xs:extension base="unit-s"/>
  </xs:simpleContent>
</xs:complexType>

The importing schema can then redefine "unit-c" and/or "unit-s":

<xs:redefine schemaLocation="unit.xsd">
  <xs:simpleType name="unit-s">
   <xs:restriction base="unit-s">
    <xs:minInclusive value="5"/>
   </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="unit-c">
   <xs:simpleContent>
    <xs:extension base="unit-c">
      <xs:attribute name="otherVal" type="xs:integer" use="required"/>
    </xs:extension>
   </xs:simpleContent>
  </xs:complexType>
</xs:redefine>

Hopes this help.

Eric
-- 
See you in Paris.
                      http://www.afnet.fr/afnet/net200x/programme.html#T9
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
Received on Thursday, 21 March 2002 02:53:36 GMT

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