member sound created CXFXJC-39:
----------------------------------

             Summary: Duplicate xs:simpleType elements block xsdtojava 
generation
                 Key: CXFXJC-39
                 URL: https://issues.apache.org/jira/browse/CXFXJC-39
             Project: CXF XJC Utils
          Issue Type: Bug
          Components: Maven Plugin
    Affects Versions: 3.3.1
            Reporter: member sound


I have two `xsd` files that I have no control over, so I cannot modify them. 
Both files show the same `xs:simpleType` node, which results in a compilation 
error during `xsdtojava` using `cxf-xjc-plugin`.

A jaxb binding file did not help, as follows:

 

xsd1:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
 <xs:simpleType name="FileKey">
 <xs:restriction base="xs:string">
 <xs:pattern value="[A-Z]+"/>
 </xs:restriction>
 </xs:simpleType>
</xs:schema>

 

xsd2:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
 <xs:simpleType name="FileKey">
 <xs:restriction base="xs:string">
 <xs:pattern value="[A-Z]+"/>
 </xs:restriction>
 </xs:simpleType>
</xs:schema>

 

binding file:

<jaxb:bindings
 xmlns:jaxb="http://java.sun.com/xml/ns/jaxb";
 xmlns:xs="http://www.w3.org/2001/XMLSchema";
 jaxb:version="2.1">

<jaxb:bindings schemaLocation="xsd1.xsd">
 <jaxb:bindings node="//xs:simpleType[@name='FileKey']">
 <jaxb:class name="FileKey1"/>
 <jaxb:property name="FileKey2"/>
 </jaxb:bindings>
 </jaxb:bindings>

<jaxb:bindings schemaLocation="xsd2.xsd">
 <jaxb:bindings node="//xs:simpleType[@name='FileKey']">
 <jaxb:class name="FileKey3"/>
 <jaxb:property name="FileKey4"/>
 </jaxb:bindings>
 </jaxb:bindings>
</jaxb:bindings>

 

error:

xsd2.xsd [8:13]: 'FileKey' is already defined
xsd1.xsd [3:35]: (related to above error) the first definition appears here
xsd2.xsd [0:0]: Failed to create model

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to