Re: Using xml:lang as an <attribute> name

Hi Ki,

> Consider the following:
>    <attribute name="xml:lang" type="string"/>
>
> The above would not be allowed because "xml:lang" is not a valid NCName,
> but the xsv seems to think it is ok.
> Also, is there any way that "xml:lang" or "xmlns" for that matter could be
> used as an <attribute>'s name value?

Since, both the prefix xml: and the name 'xmlns' are reserved by XML
Namespaces you can't use xmlns as a name in your schema and you can't use the
xml: prefix for anything except the XML Namespace. However, you can still use
the attribute xml:lang in your schema by importing the XML Namespace namespace
in your schemas like this:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
 <xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>

   <xs:complexType name="Root">
      <xs:sequence>
         <xs:element name="..."/>
      </xs:sequence>
      <xs:attribute ref="xml:lang"/>
   </xs:complexType>
</xs:schema>

Cheers,
/Eddie

Received on Saturday, 8 September 2001 03:23:57 UTC