W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2004

Re: Derivation by restriction from complexType/simpleContent

From: George Cristian Bina <george@oxygenxml.com>
Date: Thu, 02 Dec 2004 14:20:45 +0200
Message-ID: <41AF089D.3010702@oxygenxml.com>
To: Simon.Cox@csiro.au
Cc: xmlschema-dev@w3.org

Hi Simon,

 > 1. Is the "double" simpleContent preserved or not?

Yes, that is the {content type} property.
See
http://www.w3.org/TR/xmlschema-1/#declare-type
3.4.2 XML Representation of Complex Type Definitions
Complex Type Definition with simple content Schema Component
{content type}

The {content type} for MeasureType is double:
***
4 otherwise (the type definition ·resolved· to by the ·actual value· of 
the base [attribute] is a simple type definition and the <extension> 
alternative is chosen), then that simple type definition.
***
And so it is the content type for LenghtType:
***
1 If the type definition ·resolved· to by the ·actual value· of the base 
[attribute] is a complex type definition whose own {content type} is a 
simple type definition and the <restriction> alternative is chosen, then 
starting from either
1.1 the simple type definition corresponding to the <simpleType> among 
the [children] of <restriction> if there is one;
1.2 otherwise (<restriction> has no <simpleType> among its [children]), 
the simple type definition which is the {content type} of the type 
definition ·resolved· to by the ·actual value· of the base [attribute]
a simple type definition which restricts the simple type definition 
identified in clause 1.1 or clause 1.2 with a set of facet components 
corresponding to the appropriate element information items among the 
<restriction>'s [children] (i.e. those which specify facets, if any), as 
defined in Simple Type Restriction (Facets) (§3.14.6);
***

 > 2. Is there any way I can restrict the value of uom?

<complexType name="LengthType">
     <simpleContent>
         <restriction base="gml:MeasureType">
             <attribute name="uom" use="required">
                 <simpleType>
                     <restriction base="token">
                         <xs:enumeration value="meter"/>
                     </restriction>
                 </simpleType>
             </attribute>
         </restriction>
     </simpleContent>
</complexType>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Simon.Cox@csiro.au wrote:
> What is the correct syntax for derivation from complexType/simpleContent
> types?
> For example, if I write
> 
> <complexType name="MeasureType">
> 	<simpleContent>
> 		<extension base="double">
> 			<attribute name="uom" type="token"
> use="required"/>
> 		</extension>
> 	</simpleContent>
> </complexType>
> 
> <complexType name="LengthType">
> 	<simpleContent>
> 		<restriction base="gml:MeasureType"/>
> 	</simpleContent>
> </complexType>
> 
> 1. Is the "double" simpleContent preserved or not?
> 2. Is there any way I can restrict the value of uom?
> 
> Simon Cox
> ______
> Simon.Cox@csiro.au  CSIRO Exploration & Mining
> 26 Dick Perry Avenue, Kensington WA 6151
> PO Box 1130, Bentley WA 6102  AUSTRALIA
> T: +61(8) 6436 8639  F: +61(8) 6436 8555  
> C: +61(4) 0330 2672 callto://dr_shorthair 
> http://www.em.csiro.au 
>   
> 
Received on Thursday, 2 December 2004 12:17:32 GMT

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