JaxB rename class with duplicate name(JaxB 重命名具有重复名称的类)
问题描述
我必须使用包含以下片段的架构,其中名称 object
重复.
I have to use a schema which contains the following snippet where the name object
is duplicated.
Jaxb 最初很乐意导入它,但由于 Object 类被声明了两次,因此无法编译源代码.
Jaxb was originally happy to import this, but would fail to compile the sources since the Object class was declared twice.
我添加了 globalBindings
选项 localScoping="toplevel"
现在这会导致以下编译时错误:
I added globalBindings
option localScoping="toplevel"
and this now leads to the following compile time error:
org.xml.sax.SAXParseException;systemId:具有相同名称jaxb.Object"的类/接口已在使用中.使用类自定义来解决此冲突.
所以我尝试添加自定义绑定来重命名对象之一,jaxb:class
和 jaxb:property
.两者都产生相同的错误.
So I tried adding a custom binding to rename one of the objects, jaxb:class
and jaxb:property
. Both produce the same error.
如果有帮助,这是我的绑定文件:
If it helps, here is my bindings file:
如何确保其中一个实例被重命名而另一个保持不变?
How can I make sure that one of these instances gets renamed and the other is left intact?
推荐答案
正确的复杂类型.. xs:element
XSD
绑定
ParamObjectType.java
这篇关于JaxB 重命名具有重复名称的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!