I want to create an XSD, lets call that XSD_A, that resides under module: module_A. I want to reference, by either including or importing another XSD, lets call that XSD_B from another module, module_B.
XSD_B resides under the resources of module_B and should therefore be packaged into a JAR. I want the XSD_A to be compiled by xjc to create Java Classes on compile time, which I am properly using as a maven configuration without a problem so far.
XSD_B is an official XSD that starts with:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://my.own.url" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" targetNamespace="http://my.own.targetNamespace" elementFormDefault="unqualified" attributeFormDefault="unqualified" vc:minVersion="1.1">
My initial approaches are:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://example.com/b"
xmlns:ec="http://my.own.targetNamespace"
targetNamespace="http://example.com/b"
elementFormDefault="qualified">
<xs:import namespace="http://my.own.targetNamespace" schemaLocation="/PATH_TO_REFENCE_XSD_B"/>
I have also tried to use:
schemaLocation="/PATH_TO_REFENCE_XSD_B"/
Without success. My questions are:
The easiest and most reliable way is to extract the dependent schema out of the JAR file and put aside your own schema.