W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2002

anySimpleType

From: Jane Hunter <jane@dstc.edu.au>
Date: Tue, 14 May 2002 10:04:10 +1000
Message-Id: <200205140004.g4E04Ar06244@piglet.dstc.edu.au>
To: www-xml-schema-comments@w3.org
Is it possible to base new types on "anySimpleType"? For example, 
within the Dublin Core schema we want to define a generic element which 
cannot have children or be 'mixed' but has a 'lang' attribute:

  <complexType name="DCelementType"
     <simpleContent>
       <extension base="anySimpleType">
         <attribute ref="x:lang" use="optional"/>
       </extension>
     </simpleContent>
   </complexType>

   <element name="date" type="DCelementType/>

This approach allows users to restrict the base type in their own 
application profiles. For example, if a user wants their date element 
to use the more constrained 'date' datatype, they can define their own 
element based on the dc:DCelementType, in their own schema:

 <element name="myDate">
   <xs:complexType>
     <xs:simpleContent>
       <xs:restriction base="dc:DCelementType">
         <simpleContent>
           <extension base="date">
             <attribute ref="x:lang" use="optional"/>
           </extension>
         </simpleContent>
       </xs:restriction>
     </xs:simpleContent>
   </xs:complexType>
 </xs:element>

If this is not permitted, then do you have any other suggestions for 
how to do what we're trying to do - define a base simple type with a 
'lang' attribute - from which it is possible to derive other simple 
types such as date, anyURI, string etc.

regards,
Jane
+-----------------------------+-------------------------------------+
| Jane Hunter                 | Senior Research Scientist           |
| DSTC Pty Ltd                | Distributed Systems Technology CRC  |
| Level 7, GP South           | Tel   : +61 7 3365 4310             |
| University of Queensland    | Fax   : +61 7 3365 4311             |
| Queensland 4072, Australia  | Email : jane@dstc.edu.au            |
+-----------------------------+-------------------------------------+
Received on Monday, 13 May 2002 20:04:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:00 GMT