Cannot resolve the name to a(n) 'type definition' component

To generate java stub classes from xsd, we use the xjc utility that comes with the JDK. 

 

Command to execute

xjc -d generated MAINXSD.xsd

 

I recieved a couple of error while generating the stubs for a particular project i was working.

 

Error:

[ERROR] src-resolve: Cannot resolve the name 'contelec_td:c_MetPagos' to a(n) 'type definition' component.
  line 51 of file:<Location Or File>/<File>.xsd

 

 

On this particular issue, the xml namespace pointing to a schema location that was external to the environment and  "xjc"  seemed to be unable to reach that location. I download the XSD file that schema location was referring to and reran the command.

 

Original schema location

xmlns:contelec_td="http://web.location/section/package/1_3/IMPORTEDXSD" 
targetNamespace="http://web.location/section/package/1_3/MAINXSD" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:import namespace="http://web.location/section/package/1_3/IMPORTEDXSD" schemaLocation="http://web.location/section/package/1_3/IMPORTEDXSD/IMPORTEDXSD.xsd"/>

 

New schema location

xmlns:contelec_td="http://web.location/section/package/1_3/IMPORTEDXSD" 
targetNamespace="http://web.location/section/package/1_3/MAINXSD" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:import namespace="http://web.location/section/package/1_3/IMPORTEDXSD" schemaLocation="IMPORTEDXSD.xsd"/>

 

 

 

Executing the command again gave a warning:

[WARNING] Simple type "c_CodAgrupH" was not mapped to Enum due to EnumMemberSizeCap limit. Facets count: 1,136, current limit: 256. You can use customization attribute "typesafeEnumMaxMembers" to extend the limit.
  line 1400 of file:<Location of File>/IMPORTEDXSD.xsd

 

Create a binding file and customized the "EnumMemberSizeCap" property by raising the limit.

<jxb:bindings 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    version="2.1">

   <!-- Raise theEnumMemberSizeCap limit -->
   <jxb:bindings >
       <jxb:globalBindings typesafeEnumMaxMembers="2000"/>
   </jxb:bindings>


</jxb:bindings>

 

 

Rerun the command with the binding file

xjc -d generated MAINXSD.xsd -b bindings.xml