This is a problem with xerces-j 1 only, so i don't know it if it really
useful, and already discussed on xmldev list. I'm presenting it here
as a bug report in case it would be useful anyway.
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>
...
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)".
Here is my locations element definition:
<element name="locations">
<complexType>
<sequence>
<element ref="model:location" minOccurs="1" maxOccurs="unbounded"/>
...
Here are global location and country element definition:
<element name="location" type="model:LocationType"/>
<element name="country" type="model:CountryType"
substitutionGroup="model:location"/>
And here are their types:
<complexType name="LocationType" abstract="true">
<sequence>
<element name="name" type="model:InternationalizedStringType"
minOccurs="1" maxOccurs="unbounded" nillable="true"/>
...
<complexType name="CountryType">
<complexContent>
<extension base="model:LocationType">
<sequence/>
...
<complexType name="InternationalizedStringType">
<simpleContent>
<extension base="string">
<attribute ref="xml:lang" default="en"/>
</extension>
</simpleContent>
</complexType>
However, xerces-j try to validate the <name> element of <country> as the
global <name> element, which is:
<element name="name" type="model:NameType"/>
<complexType name="NameType" abstract="true">
<sequence>
� � <element name="history" minOccurs="1" maxOccurs="1" nillable="true">
...
Curiously, i have other local elements coined <name> also, with no validation
problem. It seems here the xml:lang attribute is guilty for triggering this
behaviour.
Tested with xerces-j 1.4.4, running with Sun jdk 1.3.1 on Linux.
--
Guillaume Rousse <[EMAIL PROTECTED]>
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]