0

我有这个示例 XSD - 我正在尝试使用 Jaxb 生成 Java 类。Java 类正在生成,但我们没有看到 package-info.java 类正在生成,因为 package-info.java 没有生成,编组失败并出现 QName 错误。请帮忙。

<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema  xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified"> 
      <xs:element name="Parent">
        <xs:complexType>
          <xs:sequence>
            <xs:element ref="testuser"/>
            <xs:element ref="testpassword"/>
            <xs:element minOccurs="0" ref="testname"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="testuser">
        <xs:complexType>
          <xs:attribute name="myname" use="required"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="testpassword">
        <xs:complexType>
          <xs:attribute name="mytestpassword" use="required"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="testname">
        <xs:complexType>
          <xs:attribute name="mytestname" use="required"/>
        </xs:complexType>
      </xs:element>
      </xs:schema>

我的 POM.xml:

<plugin>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <version>0.8.3</version>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <extension>true</extension>
          <args>
            <arg>-Xannotate</arg>
            </args>
          <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.0</version>
            </plugin>
          </plugins>
          <bindingIncludes>
            <include>sample/test_binding.xml</include>
          </bindingIncludes>
          <schemaIncludes>
            <include>sample.xsd</include>
          </schemaIncludes>
             <generatePackage>com.test</generatePackage>
        </configuration>
      </plugin> 
  </plugins>

绑定文件入口:

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

0 回答 0