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

Type definition for empty element

From: <Simon.Cox@csiro.au>
Date: Fri, 26 Nov 2004 18:35:22 +0800
Message-ID: <2A2B2F12CF99EA4A898E2D4729441B41ECC951@exwa2-per.wa.csiro.au>
To: <xmlschema-dev@w3.org>
What is the correct way to define a type for an empty element just
carrying attributes? 
In particular, one that can later be extended to have content. 
Is it 
 
<complexType name="typeA">
   <attribute name="att1" type="string"/>
</complexType>
 
or 
 
<complexType name="typeA">
   <sequence/>
   <attribute name="att1" type="string"/>
</complexType>
 
I getting tangled up with concerns about anyType vs empty complex type. 
>From http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#d0e9252
<http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#d0e9252>  we know
that *all* WXS type declarations are ultimately *restrictions* of
anyType. This can be made explicit as follows: 
 
<complexType name="typeA">
   <sequence/>
   <attribute name="att1" type="string"/>
</complexType>
 
could be strictly expressed 
 
<complexType name="typeA">
   <complexContent>
      <restriction base="anyType">
         <sequence/>
         <attribute name="att1" type="string"/>
      </restriction>
   </complexContent>
</complexType>
 
and I think
 
<complexType name="typeB">
</complexType>
 
implicitly just aliases "anyType" to "typeB".  
 
Hence, I'm wondering if my first example is strictly an "anyType with
attributes", rather than an empty type with attributes. 
 
______
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 <http://www.em.csiro.au/> 
  

 
Received on Friday, 26 November 2004 10:35:57 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:40:23 UTC