JAXB ne parvient pas à générer des classes Java pour XBRL

Je suis en train de générer des classes Java pour les types définis dans le langage XBRL.

Mon processus de création est basé sur Maven 2, et voici mes essais. Je ne collez le build l'article, qui s'appuie sur certaines propriétés:

package est le nom de mon package cible

catalog est le chemin d'accès et nom de fichier du catalogue. parce que je n'ai pas de connexion internet, j'ai amny entrées, mais je pense que ceux qui sont toujours nécessaires

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

xsd.path est le répertoire où le fichier XSD réside

xsd.file est le nom de fichier suivants minimaliste XSD

     <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <xs:import namespace="http://www.xbrl.org/2003/instance"
        schemaLocation="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd"/>
     </xs:schema>

Tous les plugins que j'ai essayé ne sont pas importés xl:nonEmptyURI.

Mais xl est mappé à http://www.xbrl.org/2003/XLink (qui est dans mon catalogue), les importations <import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink-2003-12-31.xsd"/> qui définit nonEmptyURI

Quel est le problème? Comment puis-je résoudre ce problème?

Apache CXF

        <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-xjc-plugin</artifactId>
            <executions>
                <execution>
                    <id>generate-sources</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>xsdtojava</goal>
                    </goals>
                    <configuration>
                        <xsdOptions>
                            <xsdOption>
                                <catalog>${catalog}</catalog>
                                <xsd>${xsd.path}/${xsd.file}</xsd>
                                <packagename>${package}</packagename>
                            </xsdOption>
                        </xsdOptions>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Échoue avec

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

jvnet maven-jaxb2-plugin

        <plugin>
            <!-- http://jaxb.java.net/-->
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.8.2</version>
            <executions>
                <execution>
                    <id>generate</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <catalog>${catalog}</catalog>
                <schemaDirectory>${xsd.path}</schemaDirectory>
                <generatePackage>${package}</generatePackage>
                <strict>false</strict>
                <extension>true</extension>
                <plugins>
                    <plugin>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-basics</artifactId>
                        <version>0.6.4</version>
                    </plugin>
                    <plugin>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-basics-annotate</artifactId>
                        <version>0.6.4</version>
                    </plugin>
                </plugins>
                <args>
                    <arg>-Xannotate</arg>
                    <arg>-XtoString</arg>
                </args>
            </configuration>
        </plugin>

L'erreur est la même, un peu plus verbeux

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

Mojo jaxb2-maven-plugin

         <plugin>
            <!--http://mojo.codehaus.org/-->
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>1.5</version>
            <executions>
                <execution>
                    <id>xjc</id>
                     <phase>generate-sources</phase>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaDirectory>${xsd.path}</schemaDirectory>
                <packageName>${package}</packageName>
                <catalog>${catalog}</catalog>
            </configuration>
        </plugin>

Même erreur, autrement dit par Xerces

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

OriginalL'auteur rds | 2012-10-16