You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Travers Waker <tr...@innoforge.co.za> on 2000/09/14 11:24:33 UTC

Schema local element scope problem in Xerces 1.2.0?

Hi.

When I get Xerces-J 1.2.0 to validate an XML document using the
simple-as-can-be schema:
----------------------------------------------------------------------------
------
<?xml version="1.0" encoding="US-ASCII"?>
<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">

<xsd:complexType name="type1">
  <xsd:element name="name" type="xsd:string"/>
</xsd:complexType>

<xsd:complexType name="type2">
  <xsd:element name="name" type="xsd:string"/>
</xsd:complexType>

</xsd:schema>
----------------------------------------------------------------------------
-----
I get the following Exception:

org.xml.sax.SAXParseException: Schema error: duplicate element decl in the
same scope : name.

But, according to W3C's XML Schema part 0: Primer document
(http://www.w3.org/TR/xmlschema-0/), the two deaclarations of the name
element should not be in the same scope.

To Quote from the final paragraph of section 2.2:
 "If the two things are elements within different types (i.e. not global
elements), say I declare one element called name as part of the Address type
and a second element called name as part of the Item type, there is no
conflict. (Such elements are sometimes called local element declarations). "

So, it looks to me like Xerces schema support is not exactly what W3C had in
mind when it comes to local element declarations.

Can anyone shed some light on this?

Thanks for any info/help.

Travers