使用JAXB绑定的类重用不支持SimpleTypes [英] Class reuse with JAXB bindings don't honour SimpleTypes
问题描述
我正在尝试重用已经编译和可用的类。这看起来可以通过声明绑定到预先存在的类来实现,如下面的示例绑定提取: -
I'm trying to reuse classes that are already compiled and available. This looks to be achievable by declaring bindings to the pre-existing classes as per example bindings extract below:-
<jaxb:bindings schemaLocation="MyExample.xsd">
<jaxb:bindings node="//xs:simpleType[@name='MySimpleType']">
<jaxb:class ref="com.example.MySimpleType" />
</jaxb:bindings>
<jaxb:bindings node="//xs:complexType[@name='MyComplexType']">
<jaxb:class ref="com.example.MyComplexType" />
</jaxb:bindings>
</jaxb:bindings>
问题是虽然复杂类型工作得很好,但简单类型会被忽略并仍然生成.. ..
The problem is that whilst complex types work just fine, the simple types are ignored and still generated....
我尝试了各种不同的符号(例如scd),但在Simple Types上没有成功。
I've tried a variety of different notations (e.g. scd) with no success on the Simple Types.
任何想法或帮助都非常欢迎....
Any ideas or help very welcome....
推荐答案
如果您尝试引用的生成的类是枚举(即它实现了 javax.xml.bind.annotation.XmlEnum
),那么您需要使用:
If the generated class you are trying to reference is an enumeration (i.e. it implements javax.xml.bind.annotation.XmlEnum
), then you need to use:
jaxb:typesafeEnumClass
而不是
jaxb:class
$绑定中的b
$ b
。
in the bindings.
这篇关于使用JAXB绑定的类重用不支持SimpleTypes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!