[
https://issues.apache.org/jira/browse/CXFXJC-38?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
member sound updated CXFXJC-38:
-------------------------------
Attachment: example.zip
> Duplicate xs:simpleType elements block xsdtojava generation
> -----------------------------------------------------------
>
> Key: CXFXJC-38
> URL: https://issues.apache.org/jira/browse/CXFXJC-38
> Project: CXF XJC Utils
> Issue Type: Bug
> Components: Maven Plugin
> Affects Versions: 3.3.1
> Reporter: member sound
> Priority: Blocker
> Attachments: example.zip
>
>
> I have two `xsd` files that show the same `xs:simpleType` element without
> sharing it. As I cannot modify the files and have not control over them, I
> tried finding a way to rename the node with a jaxb binding file. But that
> also fails 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>
>
> Result:
> 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)