There seems to be an interaction between xs:redefine referring to a schema 
which then does an xs:include that prevents Xerces from recognizing that an 
attributeGroup defined in the xs:include'd schema has been extended to include 
new attributes from a second namespace.  I think this is a bug in xerces2, but 
I'm not an XML expert, so I have some doubt.  Per the instructions on 
http://xerces.apache.org/xerces2-j/jira.html, I am emailing this list for 
clarification.

The basic setup:
base.xsd          - Defines an element named "element" with an attributeGroup
base-wrapper.xsd  - Merely does an "xs:include" of base.xsd
second-ns.xsd     - Defines an attribute named "happy" in a distinct namespace 
from one in base.xsd

augmented.xsd     - Does "xs:redefine" of base-wrapper.xsd to add the attribute 
from second-ns.xsd to the attributeGroup in base.xsd.document.xml      - Uses 
an element from base.xsd with the attribute from second-ns.xsd.


My expectation is that document.xml is valid with respect to augmented.xsd.  
However, Xerces2 reports a validation error.

# java jaxp.SourceValidator -a augmented.xsd -i document.xml
[Error] document.xml:7:3: cvc-complex-type.3.2.2: Attribute 'second:happy' is 
not allowed to appear in element 'element'.


If, instead of redefining base-wrapper.xsd, which does nothing but xs:include 
base.xsd, augmented.xsd redefine's base.xsd directly, then Xerces reports 
document.xml as valid.

I have confirmed that "xmllint" (version 20706) reports document.xml as valid.  
My JVM uses Xerces-J 2.7.1, but I have also reproduced this on xerces-2.11.0 
and on trunk using "java jaxp.SourceValidator".

Is this a bug that I should open in JIRA?  Or am I misunderstanding something 
about XML?

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to