Hi Christian,

Do you have a complete test case (in addition to the XSDs you provided,
Java code + XML document) that you can share?

Thanks.

Michael Glavassevich
XML Technologies and WAS Development
IBM Toronto Lab
E-mail: [email protected]
E-mail: [email protected]

Christian Greene <[email protected]> wrote on 01/04/2012 03:36:09
PM:

> Hi,
>
> This is not an issue when I use Xerces-J 2.9.1, but because of a
> known security issue our group is supposed to be using 2.11.0. When
> I execute validation unit tests with the 2.11.0 Xerces library,
> tests that passed validation before do not now. In advance, I will
> admit the schemas being used are complex, but it was working and I
> am wondering if anyone knows what changed and if the behavior is
> configurable or pluggable in any way.
>
> The following snippets layout the issue:
>
> SchemaA
>                 xmlns:b="http://www.acme.com/schemas";
> <xs:import namespace="http://www.acme.com/schemas"; schemaLocation=
> "SchemaB.xsd"/>
>
> <xs:complexType name="MainType">
> <xs:complexContent>
> <xs:extension base="MainType">
> <xs:group ref="b:MainTypeExtraElements"/>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
>
> <xs:complexType name="InnerType">
> <xs:complexContent>
> <xs:extension base="InnerType">
> <xs:group ref="b:InnerTypeExtraElements"/>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
>
> SchemaB
> <xs:import namespace="http://www.3rdparty.com/namespace"; schemaLocation=
> "SchemaC.xsd"/>
> <xs:import namespace="http://www.3rdparty.com/namespace"; schemaLocation=
> "SchemaD.xsd"/>
>
> <xs:group name="MainTypeExtraElements">
> <xs:sequence>
> <xs:element name="MainTypeExtra1" type="xs:string" minOccurs="0"/>
> <xs:element name="MainTypeExtra2" type="xs:string" minOccurs="0"/>
> </xs:sequence>
> </xs:group>
>
> <xs:group name="InnerTypeExtraElements">
> <xs:sequence>
> <xs:element name="InnerTypeExtra1" type="xs:string" minOccurs="0"/>
> </xs:sequence>
> </xs:group>
>
> SchemaC
> <xs:complexType name="MainType">
> <xs:sequence>
> <xs:element name="MainElement1" type="xs:string"/>
> <xs:element name="MainElement2" type="xs:boolean" minOccurs="0"/>
> <xs:element name="InnerTypeElement" type="InnerType" minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
>
> SchemaD
> <xs:complexType name="InnerType">
> <xs:sequence>
> <xs:element name="InnerElement1" type="xs:string"/>
> <xs:element name="InnerElement2" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
>
> In 2.9.1, when XML was validated that had extra elements in the
> inner type ?InnerType? it would validate fine. With 2.11.0, the
> validation fails once InnerTypeExtra1 is traversed complaining that only
> InnerElement1 or InnerElement2 is expected. So before when SchemaC
> would reference InnerType, the definition from SchemaA was used, but
> now it seems that the definition from SchemaD is used. MainTypeExtra1
> would likely fail as well if the validation ever got that far.
>
> Does that follow? Anyone have a solution?
>
> Thanks,
> -Christian

Reply via email to