使用XJCFacade解析XSD架构时。 。 。 [ERROR]'base'已经定义

时间:2013-12-11 17:06:48

标签: jaxb xsd xjc

此错误非常类似于“属性'foo'已定义。但是,请注意此错误消息未声明属性。

[ERROR] 'base' is already defined
  line 8 of http://www.legislation.gov.uk/schemaModules/xml.xsd

[ERROR] (related to above error) the first definition appears here
  line 114 of http://www.legislation.gov.uk/schemaModules/namespace.xsd

[ERROR] 'lang' is already defined
  line 9 of http://www.legislation.gov.uk/schemaModules/xml.xsd

[ERROR] (related to above error) the first definition appears here
  line 94 of http://www.legislation.gov.uk/schemaModules/namespace.xsd

[ERROR] 'space' is already defined
  line 17 of http://www.legislation.gov.uk/schemaModules/xml.xsd

[ERROR] (related to above error) the first definition appears here
  line 105 of http://www.legislation.gov.uk/schemaModules/namespace.xsd

我尝试使用XJCFacade解析http://www.legislation.gov.uk/schema/legislation.xsd处的架构并创建关联的Java类。此模式导入另一个xsd文件,该文件依次导入或引用其他xsd文件,包括上述错误中提到的两个文件。

在创建和使用绑定文件之前看过类似的问题:

<bindings ...stuff removed because of SO restrictions . . .
  extenstionBindingsPrefixes="xjc"
      version="2.1">
<bindings schemaLocation="http://www.legislation.gov.uk/schemaModules/xml.xsd" node="/xs:schema">

    <!-- Customise the package name -->
    <schemaBindings>
        <package name="com.example.schema"/>
    </schemaBindings>

    <!-- rename the value element -->
        <bindings node="//xs:attribute[@name='base']">
            <property name="baseAtt"/>
        </bindings>
        <bindings node="//xs:attribute[@name='lang']">
            <property name="langAtt"/>
        </bindings>
    <bindings node="//xs:attribute[@name='space']">
            <property name="spaceAtt"/>
        </bindings>
  </bindings>
</bindings>

它确实读取了文件,但忽略了命令。该文件肯定是被读取的,因为我故意拼错绑定文件中的一个属性,它会告诉我使用该名称找到对象。

0 个答案:

没有答案