Xsd jaxb2简化插件绑定问题

Xsd jaxb2简化插件绑定问题,xsd,jaxb2,xjc,jaxb2-simplify-plugin,Xsd,Jaxb2,Xjc,Jaxb2 Simplify Plugin,我尝试使用XJC2.2.4使用JAXB2简化插件 D:\>xjc -d . -extension -p org.my.space sample.xsd parsing a schema... [ERROR] Unsupported binding namespace "http://jaxb2-commons.dev.java.net/basic/simplify". Perhaps you meant "http://jaxb.dev.java.net/plugin/code-injec

我尝试使用XJC2.2.4使用JAXB2简化插件

D:\>xjc -d . -extension -p org.my.space sample.xsd parsing a schema... [ERROR] Unsupported binding namespace
"http://jaxb2-commons.dev.java.net/basic/simplify". Perhaps you meant
"http://jaxb.dev.java.net/plugin/code-injector"?   line 7 of file:/D:/sample.xsd
Failed to parse a schema.
sample.xsd具有声明的

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1"
    xmlns:simplify="http://jaxb2-commons.dev.java.net/basic/simplify"
    jaxb:extensionBindingPrefixes="simplify"
    xmlns="http://www.example.org/sampleXML" targetNamespace="http://www.example.org/sampleXML"
    elementFormDefault="qualified">

有什么想法吗

编辑: 我用绑定文件xjb尝试了其他方法,但仍然出现相同的错误。这是否意味着我的XJC版本(2.2)不支持JAXB2 simplify

xjc-d-扩展名-b bindings.xjb sample.xsd


我切换到了
maven jaxb2 plugin
,经过更多的努力,它工作得很好。为将来有困难的人准备。这种设置在JDK1.6中运行得很好(对于那些仍然无法迁移的用户)

pom.xml

<build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <!--  plugin to compile schemas to JAXB classes -->
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb21-plugin</artifactId>
                <version>0.13.1</version>
                <executions>
                    <execution>
                        <id>generate-JAXB</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <forceRegenerate>true</forceRegenerate>
                            <schemaDirectory>src/main/resources</schemaDirectory>
                            <schemaIncludes>
                                <include>sample.xsd</include>
                            </schemaIncludes>
                            <cleanPackageDirectories>true</cleanPackageDirectories>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <extension>true</extension>
                    <args>
                        <arg>-Xsimplify</arg>
                    </args>
                    <plugins>
                        <plugin>
                            <groupId>org.jvnet.jaxb2_commons</groupId>
                            <artifactId>jaxb2-basics</artifactId>
                            <version>0.11.0</version>
                        </plugin>
                    </plugins>
                </configuration>
            </plugin>
        </plugins>
    </build>

命名空间URi中的
s
implify
之间是否有空格,或者这是一个拼写错误?对不起,是拼写错误。现在更正了。
<build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <!--  plugin to compile schemas to JAXB classes -->
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb21-plugin</artifactId>
                <version>0.13.1</version>
                <executions>
                    <execution>
                        <id>generate-JAXB</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <forceRegenerate>true</forceRegenerate>
                            <schemaDirectory>src/main/resources</schemaDirectory>
                            <schemaIncludes>
                                <include>sample.xsd</include>
                            </schemaIncludes>
                            <cleanPackageDirectories>true</cleanPackageDirectories>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <extension>true</extension>
                    <args>
                        <arg>-Xsimplify</arg>
                    </args>
                    <plugins>
                        <plugin>
                            <groupId>org.jvnet.jaxb2_commons</groupId>
                            <artifactId>jaxb2-basics</artifactId>
                            <version>0.11.0</version>
                        </plugin>
                    </plugins>
                </configuration>
            </plugin>
        </plugins>
    </build>
<xs:complexType name="doclist">
    <xs:sequence>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
                <xs:appinfo>
                    <simplify:as-element-property />
                </xs:appinfo>
            </xs:annotation>
            <xs:element name="document1" type="type1" />
            <xs:element name="document2" type="type2" />
        </xs:choice>
    </xs:sequence>
    <xs:attribute name="heading" type="xs:string" />
</xs:complexType>