I do have a common.xsd like this
common.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1">
<xs:element name="Common">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="Person">
<xs:sequence>
<xs:element name="Firstname"/>
<xs:element name="Lastname"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
where I just define one complex type Person.
Now I have two other xsds (house.xsd and car.xsd) and both include the common.xsd (not importing).
house.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1">
<xs:include schemaLocation="common.xsd"/>
<xs:element name="House">
<xs:complexType>
<xs:sequence>
<xs:element name="Owner" type="Person"/>
<xs:element name="City">
<xs:complexType>
<xs:sequence>
<xs:element name="Name"/>
<xs:element name="ZIP"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
car.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1">
<xs:include schemaLocation="common.xsd"/>
<xs:element name="Car">
<xs:complexType>
<xs:sequence>
<xs:element name="Driver" type="Person"/>
<xs:element name="Color"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Now I want that JAXB generates the Java classes for the three xsds like this:
commons.xsd --> de/hauke/common
house.xsd --> de/hauke/house
car.xsd --> de/hauke/car
So I started with the common.xsd file with the following command
xjc -p de.hauke.common common.xsd -extension -episode common.episode
and received this episode file looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<jaxb:bindings scd="x-schema::">
<jaxb:schemaBindings map="false">
<jaxb:package name="de.hauke.common"/>
</jaxb:schemaBindings>
<jaxb:bindings scd="~Person">
<jaxb:class ref="de.hauke.common.Person"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
The java classes are also generated correctly under de/hauke/common
The next step would be generating the car.xsd java classes with this command
xjc -p de.hauke.car car.xsd -extension -b common.episode
But I don't get any errors but I also dont get any classes. This onle output is
Ein Schema wird geparst ... (schema will be parsed ...)
Ein Schema wird kompiliert ... (schema will be compiled ...)
What I am doing wrong? Is that possible with including xsds or is that only possible with importing xsds? But the importing is not a option because we don't want any namespace prefixes in any xml documents.
Thanks Hauke