Jibx Codegen:定制文件-每个模式的软件包 [英] Jibx Codegen: customization file - package per schema

查看:93
本文介绍了Jibx Codegen:定制文件-每个模式的软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目中使用Jibx maven插件从XML模式(xsd)文件生成Java源代码.我已经将pom.xml中的插件配置为使用自定义xml.在此xml中,我为每个架构定义了一个Java包,如下所示:

I'm using Jibx maven plugin in a project to generate Java source from XML schema (xsd) files. I've configured the plugin in the pom.xml to use a customization xml. In this xml, I define a Java package per schema, as presented here:

<schema-set>
    <schema name="schema1.xsd" package="com.myApp.jibxgenerated.schema.schema1"/>
    <schema name="schema2.xsd" package="com.myApp.jibxgenerated.schema.schema2" includes="element1" />
    <schema name="schema3.xsd" package="com.myApp.jibxgenerated.schema.schema3" includes="element1 element2" />
</schema-set>

我在这些架构中定义了名称空间.输出的Java源文件仍然使用模式中定义的名称空间来创建Java包,而忽略了customization.xml中的包属性.

I have namespaces defined in these schemas. The output Java source files still use the namespace defined in the schemas to create a Java package, ignoring my package attribute in the customization.xml.

我知道在源代码生成中正在读取和使用customization.xml,因为还有其他一些自定义项可以正常工作.

I know the customization.xml is being read and used in the source code generation because there are some other customizations that work correctly.

这是一个错误还是我在这里做错了什么?

Is this a bug or I'm doing something wrong here?

在此先感谢您的帮助.

推荐答案

http://jibx.sourceforge.net/fromschema/codegen-customs.html ,它们将多个schema-set嵌套在外部schema-set中.试试这个:

At http://jibx.sourceforge.net/fromschema/codegen-customs.html they nest multiple schema-sets within an outer schema-set. Try this:

<schema-set>
  <schema-set package="com.myApp.jibxgenerated.schema.schema1">
    <schema name="schema1.xsd"/>
  </schema-set>
  <schema-set package="com.myApp.jibxgenerated.schema.schema2">
    <schema name="schema2.xsd" includes="element1" />
  </schema-set>
  <schema-set package="com.myApp.jibxgenerated.schema.schema3">
    <schema name="schema3.xsd" includes="element1 element2" />
  </schema-set>
</schema-set>

这篇关于Jibx Codegen:定制文件-每个模式的软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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