2012-11-30 250 views
1

我在我的jaxB类生成了一些对象冲突,我知道我可以做的事情就像使用自定义绑定文件来解决冲突然而,这种冲突发生在两个单独的文件中具有相同名称的元素之间使用不同的名称空间。不应该有他们有不同命名空间的事实足够吗?jaxB命名空间之间的冲突

parsing a schema... 
compiling a schema... 
[ERROR] A class/interface with the same name "code.NameType" is already in use. Use a class customization to resolve this conflict. 
    line 215 of file:/C:/Workspace/schemaGen/SchemaGen/src/schemas/Core.xsd 

[ERROR] (Relevant to above error) another "NameType" is generated from here. 
    line 47 of file:/C:/Workspace/schemaGen/SchemaGen/src/schemas/SearchCore.xsd 
+0

你可以显示XSD的命名空间声明吗? – Puce

回答

0

碰撞不是命名空间的问题,而是QName生成的问题。那是他们冲突的地方。

有3个选项我已经找到了解决这个问题:

  1. 在XSD类重命名为别的东西来避免这个问题。
  2. 创建绑定文件重新映射上一代
  3. 班德从下往上做插曲文件和 每次指定一个新包生成的类,这样的对象并不在同一封装内冲突 。