RE: "External" Attributes in Element of XML Instance

Henry,

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
(2) XML Schema Namespace attributes: xmlns, xmlns:
(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

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?
(b) Where are these rule exceptions specified anywhere in XML Schema
specifications?
(c) Are there other exceptions to the rule out there that I don't know? 

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.

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

Cheers,

--Hong

-----Original Message-----
From: ht@cogsci.ed.ac.uk [mailto:ht@cogsci.ed.ac.uk]
Sent: Tuesday, March 11, 2003 4:17 AM
To: Liu, Hong
Cc: 'xmlschema-dev@w3.org'
Subject: Re: "External" Attributes in Element of XML Instance


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

> It seems to me that one can put any QName attribute in the start tag of an
> element in an XML instance document, as long as the attribute is globally
> defined in a namespace other than the target namespace (if exists) of the
> schema for the instance document. Is this true? Thanks!

Not quite -- just as for DTDs, schema-validity requires _some_ kind of
declaration for attributes -- what you're thinking of would involve an
attribute wildcard, e.g.

  <anyAttribute namespace="##other"/>

Including this in a type definition would allow any number of
attribute with an explicit prefix declared as a namespace _other_ than
the target namespace of the containing schema.

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 09:59:33 UTC