W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2002

Re: Using xml:lang in Schemas

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 19 Jun 2002 11:31:18 +0100
Message-ID: <93-1632658379.20020619113118@jenitennison.com>
To: Danny Vint <dvint@mindspring.com>
CC: xmlschema-dev@w3.org

Hi Dan,

> This seems to me to make xml:lang (how about the
> xml:preserve-space?) special XML attribute to be there and available
> by default and that any namespace requirements are automagically
> handled by the parser.

The second part of this (that the 'xml' namespace is automagically
handled by the parser) is true, but the first part (that the XML
attributes are there and available by default) is false.

The XML Namespaces Rec says:

  The prefix xml is by definition bound to the namespace name

which means that you never have to have an
xmlns:xml="http://www.w3.org/XML/1998/namespace" attribute within your
XML document (and I believe that some parsers treat this as saying
that it's an error if you *do* have this namespace declaration).

So don't worry about the fact that you're using the 'xml' prefix
without declaring it -- the mechanism that allows you to do that is
built into XML at a fairly low level.

The XML Rec says:

  A special attribute named xml:lang may be inserted in documents to
  specify the language used in the contents and attribute values of
  any element in an XML document. In valid documents, this attribute,
  like any other, must be declared if it is used.


In other words, you can use xml:lang wherever you like in XML
documents and it has a fixed semantics built into the XML Rec, but if
you're checking the validity of a document then you have to explicitly
declare the attribute in the DTD or schema against which you're

Of course in XML Schema, you don't necessarily have to declare the
fact that you're using xml:lang explicitly -- you could just use a
wildcard instead, such as:

  <xsl:anyAttribute namespace="http://www.w3.org/XML/1998/namespace"
                    processContents="lax" />

which would enable your elements to have any attributes from the XML
namespace. Otherwise, you have to reference xml:lang explicitly and,
because it's in another namespace, you have to import a schema for
that namespace.



Jeni Tennison
Received on Wednesday, 19 June 2002 06:31:20 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC