RE: Using xml:lang in Schemas

I think that's wrong:

> No, there's no rule like that. You can associate the XML namespace
> with whatever prefix you like.

"xml" is a special prefix and as of lately [1] it is clearly an
error to bind a prefix other than "xml" to that special namespace.
Thus 'xmlns:aaa="http://www.w3.org/XML/1998/namespace"'
is not permitted.

Quote:

The prefix xml is by definition bound to the namespace name
http://www.w3.org/XML/1998/namespace. It may, but need not, be declared, and
must not be bound to any other namespace name. No other prefix may be bound
to this namespace name. 

Anli Shundi

[1] http://www.w3.org/XML/xml-names-19990114-errata

--
Anli Shundi
Tibco Software
www.tibco.com

> -----Original Message-----
> From: Jeni Tennison [mailto:jeni@jenitennison.com]
> Sent: Tuesday, July 23, 2002 6:16 AM
> To: Ian Stokes-Rees
> Cc: Henry S. Thompson; Danny Vint; xmlschema-dev@w3.org
> Subject: Re: Using xml:lang in Schemas
> 
> 
> 
> Hi Ian,
> 
> > Are there special rules which _only_ allow the "xml" prefix to be
> > bound to the "XML Namespace" namespace?
> 
> In effect, yes. The 'xml' prefix is *by definition* bound to the XML
> namespace, and you're not allowed to declare a namespace with a prefix
> beginning with 'xml' yourself [1].
> 
> > Conversely, are there special rules which state that the XML
> > namespace _can_only_ be bound to the "xml" prefix?
> 
> No, there's no rule like that. You can associate the XML namespace
> with whatever prefix you like.
> 
> > By way of example:
> >
> > <foo
> > xmlns="http://www.example.com/default_namespace"
> > xmlns:xml="http://www.w3.org/XML/1998/namespace"
> > xmlns:aaa="http://www.w3.org/XML/1998/namespace"
> > xmlns:bbb="http://www.example.com/another_namespace" >
> >   <bar xml:lang="en" />
> >   <baz aaa:lang="en" />
> >   <bang bbb:lang="1234" />
> > </foo>
> >
> > Presumably the <bar> and <bang> elements are acceptable. How does
> > the schema for "http://www.example.com/default_namespace" come into
> > this?
> >
> > Does it need to explicitly allow xml:lang and bbb:lang attributes on
> > the <bar> and <bang> elements respectively?
> 
> Yes. The xml:lang attribute is exactly like any other attribute in
> terms of whether it needs to be defined in a schema (or DTD) in order
> to be valid in an instance document [2]. The only thing that's really
> special about the xml:lang attribute is that its semantics are defined
> in the XML Recommendation, which means that you can be fairly sure
> that it means the same thing (it describes the language of the content
> of the elements in its scope) whenever it's used. Conversely, we have
> no idea what bbb:lang might mean.
> 
> > Is the declaration of "http://www.w3.org/XML/1998/namespace"
> > unnecessary because it would have been declared in the schema for
> > the default namespace?
> 
> A declaration associating 'xml' with the namespace
> 'http://www.w3.org/XML/1998/namespace' is always unnecessary because
> it is present in every XML document by definition [3].
> 
> > Is there any way to add "xml:lang" attributes to an element even if
> > they are not explicitly permitted by the schema?
> 
> Of course. You can add any attribute to any element, or add any
> content to any element even if it's not explicitly permitted by the
> schema. You would still have a well-formed XML document. It just
> wouldn't be valid against the schema. If you mean can you add an
> "xml:lang" attribute to an element on which it isn't declared *and
> still have a valid document*, then the answer is no.
> 
> > I recall reading somewhere that explicitly namespaced attributes
> > could exist on elements even if they were not declared as part of
> > the parent elements schema definition of the content model. Is this
> > inaccurate (or am I imagining this)?
> 
> Either what you read was inaccurate or you imagined it. Declaring an
> attribute globally doesn't make it available on every element in the
> document. However, declaring an attribute globally does mean that a
> complex type can *refer* to that attribute declaration, such that you
> get a common attribute declaration in use on many elements.
> 
> > Looking at the schema http://www.w3.org/2001/xml.xsd continues to
> > confuse me as there are references to xml:lang without the xml
> > prefix being declared anywhere. Obviously there are things here in
> > the way namespaces, schemas, xml:lang, the "xml" character sequence,
> > and namespace prefix binding work that I don't understand and I
> > would certainly appreciate some clarification.
> 
> In essence, there's a built-in namespace declaration associating the
> prefix 'xml' with the namespace
> 'http://www.w3.org/XML/1998/namespace', so you never need to have that
> declaration present in an XML document. Aside from that, however,
> 'xml:lang' and the rest of the xml:* attributes are just like normal
> attributes.
> 
> Cheers,
> 
> Jeni
> 
> [1] http://www.w3.org/TR/REC-xml-names/#xmlReserved
> [2] http://www.w3.org/TR/REC-xml#sec-lang-tag
> [3] http://www.w3.org/TR/REC-xml-names/#nsc-NSDeclared
> 
> ---
> Jeni Tennison
> http://www.jenitennison.com/
> 
> 

Received on Wednesday, 24 July 2002 16:14:16 UTC