W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2003

Re: "External" Attributes in Element of XML Instance

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 11 Mar 2003 15:10:44 +0000
To: "Liu, Hong" <Hong.Liu@neustar.biz>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <f5bk7f6kkgb.fsf@erasmus.inf.ed.ac.uk>

"Liu, Hong" <Hong.Liu@neustar.biz> writes:

> Thanks for responding to my request. I was under the same impression as
> yours until recently when I looked at some examples more carefully.
> Specifically, there are three exceptions to the rule:
> 
> (1) XML Namespace attributes: xml:base, xml:space, xml:lang

Nope -- those have to be declared to be allowed.

> (2) XML Schema Namespace attributes: xmlns, xmlns:...

At the infoset level, those aren't really even attributes, but they're
certainly allowed.

> (3) XML Shema Instance Namespace attributes: xsi:type, xsi:nillable,
> xsi:schemaLocation, xsi:noNamespaceSchemaLocation, where xsi is the
> shorthand for the URI of the XML Schema Instance Namespace

Yes.

> These attributes seem to be able to appear in XML document instances without
> the need to define <anyAttribute> in the corresponding document schema,
> though their usage are somewhat contrained in semantics. For example,
> xsi:type is only used to signal a derived type of the element at hand to the
> XML processor.
> 
> My questions are:
> (a) Are they the only exceptions to the rule in terms of schema validation?

So in fact the http://www.w3.org/2001/XMLSchema-namespace ones are the
_only_ real exceptison.

> (b) Where are these rule exceptions specified anywhere in XML Schema
> specifications?

  http://www.w3.org/TR/xmlschema-1/#section-Built-in-Attribute-Declarations
and
  clause 3 of http://www.w3.org/TR/xmlschema-1/#cvc-complex-type

> (c) Are there other exceptions to the rule out there that I don't know? 

No.

> Looking at the schema for XML Schema: http://www.w3.org/2001/XMLSchema.xsd,
> the type "element" does include <xs:anyAttribute namespace="##other"
> processContents="lax"/> as one of its attributes. It seems, at least
> syntactically, that any attribute from a namespace other than
> #targetNamespace can appear in the start tag of any element in an instance.

Nope, that makes it so that any attribute from a namespace other than
http:/www.w3.org/2001/XMLSchema can appear on the 'element' element in
the http:/www.w3.org/2001/XMLSchema namespace, and inded on almost all
the other elements in that namespace.

> I am confused, and would like you or other XML folks out there to shed some
> lights on it. Thanks!

Hope this helps.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                      Half-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Tuesday, 11 March 2003 10:10:46 GMT

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