开发者

xjc errors out when using scd in binding customization

开发者 https://www.devze.com 2023-03-17 15:27 出处:网络
When customizing a binding using scd, non-Sun jaxb plugins are not recognized For example, this does NOT work:

When customizing a binding using scd, non-Sun jaxb plugins are not recognized

For example, this does NOT work:

<jaxb:bindings
    scd="/~fpml:TradeHeader">
    <ext:interfaces>
        example.TradeHeaderDelegateInterface
    </ext:interfaces>
</jaxb:bindings>    

However, this works:

<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>

and, this works:

<jaxb:bindings 
    scd="/~fpml:CommodityMarketDisruption//fpml:marketDisruptionEvent">
    <jaxb:property name="marketDisruptionEvent"/>
</jaxb:bindin开发者_运维问答gs>

which makes me think that scd and third party plugins don't get along:

The error I get is:

[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'.

My .xjb file does declare the namespace for the "ext" prefix, so that's not the issue.

Has anyone worked with xjc plugins (e.g. the jaxb commons ones like Copyable etc.) and gotten it to work with scd based customization?

My xjc version is: 2.2.2 and I'm using the maven-jaxb2-plugin (version 0.8.0) plugin to generate bindings.

Thanks for any help,

aravind


maven-jaxb22-plugin:jar:0.8.1:runtime, com.sun.xml.bind:jaxb-impl:jar:2.2.5-b10:runtime, com.sun.xml.bind:jaxb-xjc:jar:2.2.5-b10:runtime] still exhibit this issue.

From looking at the xjc source code (some time ago) this is NOT an easy fix, because the customizations are not "imported" into the target xsd and the processing occurs in the context of the matched component.

This is the case with the Schema parser where by the schema is "imported" into the bindings context so all the namespaces are valid.

I have reverted all customizations back to schema style. I remember this had painful implications when trying to do both wsdl and xsd in the same bindings file.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号