W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2010

RE: Adding attributes to anyType

From: Michael Kay <mike@saxonica.com>
Date: Fri, 9 Apr 2010 18:19:03 +0100
To: "'Simon Cox'" <simon.cox@jrc.ec.europa.eu>, <xmlschema-dev@w3.org>
Message-ID: <23A2C46A8EE54841BC43F140CABC4A0D@Sealion>
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 GMT

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