【发布时间】:2011-07-06 20:39:25
【问题描述】:
使用 scd 自定义绑定时,无法识别非 Sun jaxb 插件
例如,这不起作用:
<jaxb:bindings
scd="/~fpml:TradeHeader">
<ext:interfaces>
example.TradeHeaderDelegateInterface
</ext:interfaces>
</jaxb:bindings>
但是,这是可行的:
<jaxb:bindings
schemaLocation="../schemas/fpml-5-1/fpml-doc-5-1.xsd"
node="/xsd:schema//xsd:complexType[@name='TradeHeader']">
<ext:interfaces>
example.TradeHeaderDelegateInterface
</ext:interfaces>
</jaxb:bindings>
而且,这有效:
<jaxb:bindings
scd="/~fpml:CommodityMarketDisruption//fpml:marketDisruptionEvent">
<jaxb:property name="marketDisruptionEvent"/>
</jaxb:bindings>
这让我觉得 scd 和第三方插件无法相处:
我得到的错误是:
[ERROR] Error while parsing schema(s).Location [ file:/C:/projects/domain-fpml-5-1/src/main/resources/xjb/fpml-5-1.xjb{40,19}].
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'ext:interfaces'.
我的 .xjb 文件确实为“ext”前缀声明了命名空间,所以这不是问题。
有没有人使用过 xjc 插件(例如,jaxb commons 插件,如 Copyable 等)并让它与基于 scd 的定制一起使用?
我的 xjc 版本是:2.2.2,我正在使用 maven-jaxb2-plugin(版本 0.8.0)插件生成绑定。
感谢您的帮助,
阿拉维德
【问题讨论】:
-
我也在观察这个问题。烦人,因为基于 SCD 的方法显然更可取(即当它有效时)。相关:jira.highsource.org/browse/JIIB-47