I'm using jaxb and xjc to autogenerate java classes from xsd files.
Problem: I have two files that show the same simpleType name. And thus get a compilation error:
xsd1.xsd [49:3]: 'FileKey' is already defined
xsd1:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:simpleType name="FileKey">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z0-9_]+" />
</xs:restriction>
</xs:simpleType>
...
</xs:schema>
xsd2:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:simpleType name="FileKey">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z0-9_]+" />
</xs:restriction>
</xs:simpleType>
...
</xs:schema>
My binding file that I tried:
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:version="2.1">
<jaxb:bindings schemaLocation="xsd1.xsd">
<jaxb:bindings node="//xs:simpleType[@name='FileKey']">
<jaxb:class name="FileKeyRenamed" />
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
Sidenote: I cannot modify the xsds, as I have no conrol of them.