RE: Adding attributes to anyType

I don't think there's any rule against this in the spec: it satisfies all
the rules of Schema Component Constraint: Derivation Valid (Extension).
 
Essentially xs:anyType has an attribute wildcard allowing any attribute; and
it's legal when deriving a type by extension to add attribute uses that
overlap an existing (newly defined or inherited) attribute wildcard.
 
The rules of Validation Rule: Element Locally Valid (Complex Type) mean that
if the element has an attribute named att1 then it must be valid against the
attribute use; it will not be validated against the wildcard. So the
semantics are that of a restriction.
 
So it might not make much sense; and I would tend to define it as a
restriction rather than an extension; but I think it's legal.
 
Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 


  _____  

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Simon Cox
Sent: 09 April 2010 17:56
To: xmlschema-dev@w3.org
Subject: Adding attributes to anyType


Some colleagues are proposing a schema within which attributes are added to
xs:anyType using the XSD extension mechanism. 
For example 
 
<complexType name="NewType">
  <complexContent>
    <extension base="anyType">
      <attribute name="att1" type="string"/>
    </extension>
  </complexContent>
</complexType>

I don't see how this makes sense, since anyType is an infinite set, so all
specific content models must be derived by restriction. 
But Xerces (in oXygen) doesn't complain. 
 
Is Xerces wrong or am I mistaken?

--------------------------------------------------------
Simon Cox

European Commission, Joint Research Centre 
Institute for Environment and Sustainability 
Spatial Data Infrastructures Unit, TP 262 
Via E. Fermi, 2749, I-21027 Ispra (VA), Italy 
Tel: +39 0332 78 3652 
Fax: +39 0332 78 6325 
 <mailto:simon.cox@jrc.ec.europa.eu> mailto:simon.cox@jrc.ec.europa.eu 
 <http://ies.jrc.ec.europa.eu/simon-cox>
http://ies.jrc.ec.europa.eu/simon-cox 

SDI Unit:  <http://sdi.jrc.ec.europa.eu/> http://sdi.jrc.ec.europa.eu/ 
IES Institute:  <http://ies.jrc.ec.europa.eu/> http://ies.jrc.ec.europa.eu/ 
JRC:  <http://www.jrc.ec.europa.eu/> http://www.jrc.ec.europa.eu/

--------------------------------------------------------

 

Any opinions expressed are personal unless otherwise indicated. 

Received on Friday, 9 April 2010 17:19:34 UTC