While parsing an XSD schema with XJCFacade . . . [ERROR] 'base' is already defined

720 Views Asked by At

This error is very similar to "Property 'foo' is already defined. However, please notice this error message does not state property.

[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

I am try to use XJCFacade to parse the schema at http://www.legislation.gov.uk/schema/legislation.xsd and create associated Java classes. This schema imports another xsd file which in turns imports or references other xsd files including the two mentioned in the errors above.

Having seen similar problems before I have create and use a bindings file:

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

It does read the file but otherwise ignores the the commands. The file is definitely being read because is I purposely misspell one of the attributes in the bindings file it will tell me to object were found with that name.

0

There are 0 best solutions below