validation problem, conflicting element scope ?

I got the following XML fragment
<locations id="loc">
  <country id="loc1">
    <name xml:lang="fr">Argentine</name>
    <name xml:lang="en">Argentina</name>
    <name xml:lang="es">Argentina</name>
    <name xml:lang="pr">Argentina</name>
    <code>ARG</code>
  </country>
...
wich triggers the following validation messages from xerces-j
[Error] cipa.xml:29361:29: General Schema Error: Element name is declared 
with a type that is abstract.  Use xsi:type to specify a non-abstract type.
[Error] cipa.xml:29361:29: Attribute "xml:lang" must be declared for element 
type "name".
[Error] cipa.xml:29361:45: The content of element type "name" must match 
"(history)".

It seems xerces-j try to validate the <name> element as the global 
definition, not as the local one. And curiously, this conflict only happens 
here, whereas i have plenty of other local name elements elsewhere...

Here are the global elements definition:
<element name="locations" minOccurs="0" maxOccurs="1">
  <complexType>
    <sequence>
      <element ref="model:location" minOccurs="1" maxOccurs="unbounded"/>
    </sequence>
    <attribute name="id" type="model:KeyType"/>
  </complexType>
</element>
<element name="name" type="model:NameType"/>
<element name="location" type="model:LocationType"/>
<element name="country" type="model:CountryType" 
substitutionGroup="model:location"/>

And here are the type
<complexType name="NameType" abstract="true">
    <annotation>
      <documentation>A scientific name</documentation>
    </annotation>
    <sequence>
      <element name="history" minOccurs="1" maxOccurs="1" nillable="true">
        <complexType>
          <sequence>
            <element name="creation" type="model:NameCreationType" 
minOccurs="1" maxOccurs="1" nillable="true"/>
            <element name="modification" type="model:NameModificationType" 
minOccurs="0" maxOccurs="unbounded"/>
          </sequence>
        </complexType>
      </element>
    </sequence>
    <attribute name="id" type="model:KeyType"/>
  </complexType>

<complexType name="LocationType" abstract="true">
    <annotation>
      <documentation>An abstract location</documentation>
    </annotation>
    <sequence>
      <element name="name" type="model:InternationalizedStringType" 
minOccurs="1" maxOccurs="unbounded" nillable="true"/>
    </sequence>
    <attribute name="id" type="model:KeyType"/>
  </complexType>

  <complexType name="CountryType">
    <annotation>
      <documentation>A country location</documentation>
    </annotation>
    <complexContent>
      <extension base="model:LocationType">
        <sequence>
          <element name="code" type="string" minOccurs="1" maxOccurs="1"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

<complexType name="InternationalizedStringType">
    <simpleContent>
      <extension base="string">
        <attribute ref="xml:lang" default="en"/>
      </extension>
    </simpleContent>
  </complexType>

-- 
Guillaume Rousse <rousse@ccr.jussieu.fr>
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html

Received on Wednesday, 5 December 2001 14:33:01 UTC