Hi,
I 'd like to validate a XML message with external schemas but i need to
respect the following constraints:
- I can not modify XML schemas files. They use xml:include under the same
targetnamespace.
- it has to run on xerces 2.6.2
- XML schemas are included in Jar of wars so they should loaded with a
classloader.
So far, the Xerces 2.6.2 does not seem to follow includes. (and ignore them)
I tried to different solutions:
1) specifying a XML catalog with :
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
prefer="public">
<uri name="urn:Folder"
uri="Folder.xsd"/>
<uri name="urn:Folder"
uri="basicTypes.xsd"/>
</catalog>
But it doesn't work because i guess i can not declare the same name in uri
elements of the catalog.
2) Setting the following JAXP parser property:
parser.setProperty(
"http://java.sun.com/xml/jaxp/properties/schemaSource",
new InputSource[]{......});
where the array of InputSource files contains all the schemas. But since
they declare the same target namespace i get the following error:
java.lang.IllegalArgumentException: When using array of Objects as the
value of SCHEMA_SOURCE property , no two Schemas should share the same
targetNamespace.
3) Using xerces property
parser.setProperty("
http://apache.org/xml/properties/schema/external-schemaLocation",
"urn:Folder CreerDossier.xsd,urn:Folder basicTypes.xsd");
without success.
4)EntityResolver:
I still have the same issue because included schemas use the same
targetnamespace:
Which inputSource should I return ?
public InputSource resolveEntity (String publicId, String systemId)
{
}
So if you have any clue on how to solve this,
i'd be glad to know.
Luc