title: JAXB fails to generate Java classes for XBRL
body: <p>I'm trying to generate Java classes for types defined in XBRL.</p>
  
  <p>My build process is based on Maven 2, and here are my trials. I only paste the <code>build</code> section, which relies on some properties:</p>
  
  <p><code>package</code> is the name of my target package</p>
  
  <p><code>catalog</code> is the path and file name of the catalog. because I have no internet connection, I have amny entries, but I think those are always necessary</p>
  
  <pre><code>-- TR9401 for XBRL resources --
  SYSTEM http://www.xbrl.org/2003/XLink http/www.xbrl.org/2003/xl-2003-12-31.xsd
  SYSTEM http://www.w3.org/1999/xlink http/www.xbrl.org/2003/xlink-2003-12-31.xsd
  </code></pre>
  
  <p><code>xsd.path</code> is the directory where the XSD resides</p>
  
  <p><code>xsd.file</code> is the file name of the following minimalist XSD</p>
  
  <pre><code>     &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
         &lt;xs:import namespace="http://www.xbrl.org/2003/instance"
          schemaLocation="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd"/&gt;
       &lt;/xs:schema&gt;
  </code></pre>
  
  <p>All plugins I have tried fail to import <code>xl:nonEmptyURI</code>.</p>
  
  <p>But <code>xl</code> is mapped to <code>http://www.xbrl.org/2003/XLink</code> (which is in my catalog) which imports  <code>&lt;import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink-2003-12-31.xsd"/&gt;</code> which defines  <code>nonEmptyURI</code></p>
  
  <p>What's wrong? How can I fix it?</p>
  
  <h1>Apache CXF</h1>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-xjc-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;generate-sources&lt;/id&gt;
                      &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;xsdtojava&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;xsdOptions&gt;
                              &lt;xsdOption&gt;
                                  &lt;catalog&gt;${catalog}&lt;/catalog&gt;
                                  &lt;xsd&gt;${xsd.path}/${xsd.file}&lt;/xsd&gt;
                                  &lt;packagename&gt;${package}&lt;/packagename&gt;
                              &lt;/xsdOption&gt;
                          &lt;/xsdOptions&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>Fails with</p>
  
  <pre><code>parsing a schema...
  
  [ERROR] src-resolve: Cannot resolve the name 'xl:nonEmptyURI' to a(n) 'type definition' component.
    line 389 of cache/http/www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd
  </code></pre>
  
  <h1>jvnet maven-jaxb2-plugin</h1>
  
  <pre><code>        &lt;plugin&gt;
              &lt;!-- http://jaxb.java.net/ --&gt;
              &lt;groupId&gt;org.jvnet.jaxb2.maven2&lt;/groupId&gt;
              &lt;artifactId&gt;maven-jaxb2-plugin&lt;/artifactId&gt;
              &lt;version&gt;0.8.2&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;generate&lt;/id&gt;
                      &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;generate&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                  &lt;catalog&gt;${catalog}&lt;/catalog&gt;
                  &lt;schemaDirectory&gt;${xsd.path}&lt;/schemaDirectory&gt;
                  &lt;generatePackage&gt;${package}&lt;/generatePackage&gt;
                  &lt;strict&gt;false&lt;/strict&gt;
                  &lt;extension&gt;true&lt;/extension&gt;
                  &lt;plugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.jvnet.jaxb2_commons&lt;/groupId&gt;
                          &lt;artifactId&gt;jaxb2-basics&lt;/artifactId&gt;
                          &lt;version&gt;0.6.4&lt;/version&gt;
                      &lt;/plugin&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.jvnet.jaxb2_commons&lt;/groupId&gt;
                          &lt;artifactId&gt;jaxb2-basics-annotate&lt;/artifactId&gt;
                          &lt;version&gt;0.6.4&lt;/version&gt;
                      &lt;/plugin&gt;
                  &lt;/plugins&gt;
                  &lt;args&gt;
                      &lt;arg&gt;-Xannotate&lt;/arg&gt;
                      &lt;arg&gt;-XtoString&lt;/arg&gt;
                  &lt;/args&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>The error is the same, a little more verbose</p>
  
  <pre><code>[INFO] Parsing input schema(s)...
  [ERROR] Error while parsing schema(s).Location [ cache/http/www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd{389,74}].
  org.xml.sax.SAXParseException: undefined simple type 'xl:nonEmptyURI'
      at com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.java:180)
      at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.java:175)
      at com.sun.xml.xsom.impl.parser.DelayedRef.resolve(DelayedRef.java:110)
  [...]
  [ERROR] Error while parsing schema(s).Location [ cache/http/www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd{412,77}].
  org.xml.sax.SAXParseException: undefined simple type 'xl:nonEmptyURI'
      at com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.java:180)
      at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.java:175)
      at com.sun.xml.xsom.impl.parser.DelayedRef.resolve(DelayedRef.java:110)
  [ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.8.2:generate (generate) on project solvency2: Unable to parse input schema(s). Error messages should have been provided. -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.8.2:generate (generate) on project solvency2: Unable to parse input schema(s). Error messages should have been provided.
  </code></pre>
  
  <h1>Mojo jaxb2-maven-plugin</h1>
  
  <pre><code>         &lt;plugin&gt;
              &lt;!--http://mojo.codehaus.org/ --&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb2-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.5&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;xjc&lt;/id&gt;
                       &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;xjc&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                  &lt;schemaDirectory&gt;${xsd.path}&lt;/schemaDirectory&gt;
                  &lt;packageName&gt;${package}&lt;/packageName&gt;
                  &lt;catalog&gt;${catalog}&lt;/catalog&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>Same error, said differently by Xerces</p>
  
  <pre><code>[ERROR] file:[...]cache/http/www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd[472,74]
  org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'xl:nonEmptyURI' to a(n) 'simpleType definition' component.
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
  </code></pre>