Using xml:lang in Schemas

I'm trying to determine how xml:lang is to be used with Schemas. In the Pt1 
document we have the following XSD element definitions that include a 
reference to xml:lang:

3.13.2 XML Representation of Annotation Schema Components
Annotation of schemas and schema components, with material for human or 
computer consumption, is provided
for by allowing application information and human information at the 
beginning of most major schema elements,
and anywhere at the top level of schemas. The XML representation for an 
annotation schema component is an
<annotation> element information item. The correspondences between the 
properties of that information item
and properties of the component it corresponds to are as follows:
XML Representation Summary: annotation Element Information Item
<annotation
id = ID
{any attributes with non-schema namespace . . .}>
Content: (appinfo | documentation)*
</annotation>
<appinfo
source = anyURI>
Content: ({any})*
</appinfo>
<documentation
source = anyURI
xml:lang = language>
Content: ({any})*
</documentation>
AND HERE
3.15.2 XML Representations of Schemas
A schema is represented in XML by one or more ·schema documents·, that is, 
one or more <schema>
element information items. A ·schema document· contains representations for 
a collection of schema
components, e.g. type definitions and element declarations, which have a 
common {target namespace}. A
·schema document· which has one or more <import> element information items 
corresponds to a schema with
components with more than one {target namespace}, see Import Constraints 
and Semantics (§4.2.3).
XML Representation Summary: schema Element Information Item
<schema
attributeFormDefault = (qualified | unqualified) : unqualified
blockDefault = (#all | List of (extension | restriction |
substitution)) : ''
elementFormDefault = (qualified | unqualified) : unqualified
finalDefault = (#all | List of (extension | restriction)) : ''
id = ID
targetNamespace = anyURI
version = token
xml:lang = language
{any attributes with non-schema namespace . . .}>
Content: ((include | import | redefine | annotation)*, (((simpleType |
complexType | group | attributeGroup) | element | attribute | notation),
annotation*)*)
</schema>


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.

Currently I have tried to use this with XML Spy which seems to force a 
required definition to be available to use this in an <xsd:element> 
definition. I tried defining the names space on the <xsd:schema> element 
and then using an <xsd:attroibute ref="xml:lang" in the element 
description. I noted that an I can't use this <xml:attribute 
name="xml:lang" because of some rule about using prefixes in attribute name 
definitions and besides this is something that is supposed to "Just be 
there" from an XML standpoint.

The SPy folks indicate that this is the proper way to access at least the 
xml:lang attribute:

<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd">
<xs:annotation>
<xs:documentation>
Get access to the xml: attribute groups for
xml:lang
</xs:documentation>
</xs:annotation>
</xs:import>
And then you can use xml:lang as an attribute:
<xs:attribute ref="xml:lang"/>

Now this seems odd, if it is complete, that I have the proper namespace URL 
being referenced, but I have nothing that maps the xml prefix to this 
namespace - sort of makes me feel like there is some half built in 
understanding that xml: is reserved and that it points to that namespace - 
but don't use it unless you define it!

Anyway, what is the opinion or real way that this should be defined? I 
don't find the Schema spec to be much use in determining the actual way to 
use these attributes.

..dan

Received on Tuesday, 18 June 2002 14:32:30 UTC