I'm trying to generate some Java code from quite a lot XSD's. Most of them work quite nicely, however I have trouble with one specific XSD which imports another XSD with a relative path. An example:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:xmpl="http://example.com/this/is/namespace" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.com/this/is/namespace">
<include schemaLocation="../../0301/required.xsd" />
<some> ... xml ... </some>
</schema>
This is an anonymised XSD because of the client, of course. However, I have already build the other XSD which it is referring to in another module. Which is working great by the way. So now I want to resolve the include, but I'm currently unsuccesful. I have tried different and multiple catalogs, like so:
<!DOCTYPE catalog
PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
<public publicId="required.xsd" uri="maven:com.geodan.imgeo:stuf!stuf0301!stuf/stuf0301.xsd" />
<public publicId="../../0301/required.xsd" uri="maven:com.project.example!module!folder/required.xsd" />
<public publicId="http://example.com/this/is/namespace/required.xsd" uri="maven:com.project.example!module!folder/required.xsd" />
<public publicId="http://example.com/this/is/namespace/../../required.xsd" uri="maven:com.project.example!module!folder/required.xsd" />
<public publicId="http://example.com/stuf0301.xsd" uri="maven:com.project.example!module!folder/required.xsd" />
</catalog>
and
--
Standard Catalog test file for Imgeo
--
PUBLIC "http://example.com/this/is/namespace/required.xsd" "module/src/main/resources/folder/required.xsd"
PUBLIC "../../0301/required.xsd" "module/src/main/resources/folder/required.xsd"
PUBLIC "0301/required.xsd" "module/src/main/resources/folder/required.xsd"
But it just won't work. Anybody has any ideas?
Unfortunately, the maven-jaxb2-plugin project has an open issue on this subject: Allow rewriting system ids for local files #19