简体   繁体   English

Jibx Codegen:定制文件-每个模式的软件包

[英]Jibx Codegen: customization file - package per schema

I'm using Jibx maven plugin in a project to generate Java source from XML schema (xsd) files. 我在一个项目中使用Jibx maven插件从XML模式(xsd)文件生成Java源代码。 I've configured the plugin in the pom.xml to use a customization xml. 我已经将pom.xml中的插件配置为使用自定义xml。 In this xml, I define a Java package per schema, as presented here: 在此xml中,我为每个架构定义了一个Java包,如下所示:

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

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. 输出的Java源文件仍然使用模式中定义的名称空间来创建Java包,而忽略了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. 我知道在源代码生成中正在读取和使用customization.xml,因为还有其他一些自定义项可以正常工作。

Is this a bug or I'm doing something wrong here? 这是错误还是我在这里做错了什么?

Thanks in advance for any help. 在此先感谢您的帮助。

At http://jibx.sourceforge.net/fromschema/codegen-customs.html they nest multiple schema-set s within an outer schema-set . http://jibx.sourceforge.net/fromschema/codegen-customs.html上,它们将多个schema-set嵌套在一个外部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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM