You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Steven J Baker <sj...@ambrielconsulting.com> on 2003/08/28 12:13:28 UTC

Possible bug in Xerces2-J v2.5.0 schema validation: attributeGroup redefinition

The attached files mirror the arrangement of a set of libraries I am
currently developing and demonstrate a possible bug in Xerces2-J schema
validation. 

There are two chameleon schemas, one of types and one of structures. The
structures schema includes the types schema. The document schema
(Greeting.xsd) redefines the structures schema, changing an attribute
group originally declared in the types schema.

When Xerces2-J 2.5.0 validates Greeting.xml against Greeting.xsd, a
schema error is given for a circular definition of the attribute group
but the validation proceeds and returns the correct result.

If the content of the types schema is physically included in the
structures schema instead of using xsd:include, there is no error.

As a cross-check, XML Spy behaves as expected.

The behaviour on RedHat Linux 9.0 was as follows:

------

[sjb@jupiter Greeting]$ java -version
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)

[sjb@jupiter Greeting]$ export CLASSPATH=\
  /usr/local/java/xerces-2_5_0/xercesImpl.jar:\    
  /usr/local/java/xerces-2_5_0/xercesSamples.jar:\
  /usr/local/java/xerces-2_5_0/xml-apis.jar

[sjb@jupiter Greeting]$ java -Xms64m -Xmx512m dom.ASBuilder -f \
  -a  Greeting.xsd GreetingStructures.xsd GreetingTypes.xsd \
  -i Greeting.xml

[Error] GreetingTypes.xsd:6:44: src-attribute_group.3: Circular
definitions detected for attribute group
':langAttrGroup_fn3dktizrknc9pi'. Recursively following attribute group
references eventually leads back to itself.

[Error] GreetingTypes.xsd:6:44: src-redefine.7.2.1: No attributeGroup in
the redefined schema has a name matching 'langAttrGroup'.

[Error] Greeting.xml:4:14: cvc-complex-type.4: Attribute 'lang' must
appear on element 'Greeting'.

# And the correct behaviour with the workaround:
[sjb@jupiter Greeting]$ java -Xms64m -Xmx512m dom.ASBuilder -f \
  -a Greeting.xsd GreetingStructures.xsd \
  -i Greeting.xml

[Error] Greeting.xml:4:14: cvc-complex-type.4: Attribute 'lang' must
appear on element 'Greeting'.

-----

Anyone seen similar please, before I submit a bug report.

Thanks

Steve
-- 
Steven J Baker <sj...@ambrielconsulting.com>
Ambriel Consulting