title: How to declare an xml:lang attribute in an XML Schema?
body: <p>I'm trying to declare an <code>xml:lang</code> attribute in XML Schema for the following sample instance:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;database xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xml-lang-1.xsd"&gt;
      &lt;entry&gt;
          &lt;language xml:lang="en"&gt;
              &lt;other_data/&gt;
          &lt;/language&gt;
          &lt;language xml:lang="nl"&gt;
              &lt;other_data/&gt;
          &lt;/language&gt;
      &lt;/entry&gt; 
  &lt;/database&gt;
  </code></pre>
  
  <p>For the moment, I got two solutions:</p>
  
  <ol>
  <li><p>Using:</p>
  
  <pre><code>&lt;xs:attributeGroup name="XMLNamespaceAttrs"&gt;
    &lt;xs:anyAttribute namespace="http://www.w3.org/XML/1998/namespace" processContents="lax"/&gt;
  &lt;/xs:attributeGroup&gt;
  </code></pre></li>
  </ol>
  
  <p>within the same schema, or</p>
  
  <ol start="2">
  <li><p>Using <code>xs:import</code> and importing:</p>
  
  <pre><code>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/XML/1998/namespace"&gt;
     &lt;xs:import schemaLocation="xml-lang-2.xsd"/&gt;
     &lt;xs:attribute name="lang" type="xs:NCName"/&gt;
  &lt;/xs:schema&gt;
  </code></pre></li>
  </ol>
  
  <p>from an external file.</p>
  
  <p>My questions:</p>
  
  <ul>
  <li>Are there other ways to declare the xml:lang attribute in XML Schema?</li>
  <li>How can I associate a use attribute with the xml:lang attribute? In the examples above, the use attribute is not allowed with the
  xs:anyAttribute (solution 1) and the xs:attribute (solution 2).</li>
  <li>Is the data type for <code>xml:lang</code> in the examples above handeled implicitely as <code>xs:languag</code>e (or other) or needs this to be/can this be
  declared explicitely?</li>
  </ul>
  
  <p>Many thanks in advance for your help.</p>