使用JAXB 2.1将多个模式编译到不同的包中 [英] Compiling multiple schemas into different packages using JAXB 2.1

查看:52
本文介绍了使用JAXB 2.1将多个模式编译到不同的包中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个CommonTypes.xsd,我使用xs:include包含在我的所有其他XSD中。我得到了

I have a CommonTypes.xsd which I'm including in my all other XSDs using xs:include. I get

Multiple <schemaBindings> are defined for the target namespace ""

当我尝试使用绑定文件将其编译到不同的包中时。请告诉我是否有办法将它们编译成不同的包。我正在使用jaxb 2.1

when I try to compile it into different packages using binding files. Please tell me whether there is a way to compile them into different packages. I'm using jaxb 2.1

推荐答案

如Ben已经说明的那样,如果它们具有相同的命名空间,则无法做到这一点。
但如果你有不同的命名空间怎么做?

As stated already by Ben there is no way to do that if they have the same namespace. But how to do it if you do have different namespaces?

<jxb:bindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb" version="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    <jxb:bindings namespace="http://www.openapplications.org/oagis/9/unqualifieddatatypes/1.1" schemaLocation="oagi/Common/UNCEFACT/ATG/CoreComponents/UnqualifiedDataTypes.xsd" >
        <jxb:schemaBindings>
            <jxb:package name="com.test.oagi.udt"/>
        </jxb:schemaBindings>
    </jxb:bindings>
    <jxb:bindings namespace="http://www.openapplications.org/oagis/9/codelists" schemaLocation="oagi/Common/OAGi/Components/CodeLists.xsd" >
        <jxb:schemaBindings>
            <jxb:package name="com.test.oagi.cl"/>
        </jxb:schemaBindings>
    </jxb:bindings>
</jxb:bindings>

但请确保您不使用命令行参数-p,因为这将覆盖您的配置。

but be sure you do not use the command line parameter -p, since that will override your config.

这篇关于使用JAXB 2.1将多个模式编译到不同的包中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆