1

我试图从第三方提供的 XSD 生成 Java 类。但是我得到的错误是

[错误] 文件:/Users/sanket/eblock/code/eblock-graphql/eblock-integration/autotec-auction-access-sqs/src/main/resources/xsd/COMP9.xsd[243,16] org.xml。 sax.SAXParseException: 'GovernmentIDType' 已定义

对于其他元素,我也遇到了同样的错误。我尝试向 XSD 添加唯一的命名空间,但没有奏效。这个特定元素“GovernmentIDType”的定义在两个 XSD 中不同,但名称相似。

COMP9.xsd

    <?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2009 sp1 (http://www.altova.com) by Charles Redden (AutoTec, LLC) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
        <xs:include schemaLocation="Header9.xsd"/>
        <xs:annotation>
            <xs:documentation>Company Message</xs:documentation>
        </xs:annotation>
        <xs:element name="BondingCompany">
            <xs:annotation>
                <xs:documentation>Name of bonding company.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="75"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="BondExpirationDate">
            <xs:annotation>
                <xs:documentation>Expiration date of bond.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:union memberTypes="xs:date">
                    <xs:simpleType>
                        <xs:restriction base="xs:token">
                            <xs:enumeration value=""/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:union>
            </xs:simpleType>
        </xs:element>
        <xs:element name="BondNumber">
            <xs:annotation>
                <xs:documentation>Bond number as it appears on bond.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="50"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="BusinessStartDate">
            <xs:annotation>
                <xs:documentation>Date company came into business.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:union memberTypes="xs:date">
                    <xs:simpleType>
                        <xs:restriction base="xs:token">
                            <xs:enumeration value=""/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:union>
            </xs:simpleType>
        </xs:element>
        <xs:element name="CommercialAccountType">
            <xs:annotation>
                <xs:documentation>Type of commercial account.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="Bank / Credit Union"/>
                    <xs:enumeration value="Financial Services Company"/>
                    <xs:enumeration value="Insurance Company"/>
                    <xs:enumeration value="Manufacturer"/>
                    <xs:enumeration value="Rental Car Company"/>
                    <xs:enumeration value="Captive Finance Company"/>
                    <xs:enumeration value="Fleet Company"/>
                    <xs:enumeration value="Government Agency"/>
                    <xs:enumeration value="Salvage/Scrap Company"/>
                    <xs:enumeration value="Other Business Organization"/>
                    <xs:enumeration value="Auction"/>
                    <xs:enumeration value="Non-Profit Company"/>
                    <xs:enumeration value="Public"/>
                    <xs:enumeration value="Title Loan Company"/>
                    <xs:enumeration value="Subprime Finance Company"/>
                    <xs:enumeration value="Transporter"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="CompanyID">
            <xs:annotation>
                <xs:documentation>AutoTec Company ID</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:int">
                    <xs:maxInclusive value="8999999"/>
                    <xs:minInclusive value="5000000"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="CompanyInformation">
            <xs:complexType>
                <xs:sequence>
                    <xs:element ref="CompanyID"/>
                    <xs:element ref="DBAName"/>
                    <xs:element ref="LegalName" minOccurs="0"/>
                    <xs:element ref="CompanyType"/>
                    <xs:element ref="GovernmentID" minOccurs="0"/>
                    <xs:element ref="GovernmentIDType" minOccurs="0"/>
                    <xs:element ref="GovernmentIDCountry" minOccurs="0"/>
                    <xs:element ref="EntityType" minOccurs="0"/>
                    <xs:element ref="PublicSaleOnly" minOccurs="0"/>
                    <xs:element ref="NICBNumber" minOccurs="0"/>
                    <xs:element ref="DunandBradstreetNumber" minOccurs="0"/>
                    <xs:element ref="InsuranceCompany" minOccurs="0"/>
                    <xs:element ref="PolicyNumber" minOccurs="0"/>
                    <xs:element ref="InsuranceExpirationDate" minOccurs="0"/>
                    <xs:element ref="BondingCompany" minOccurs="0"/>
                    <xs:element ref="BondNumber" minOccurs="0"/>
                    <xs:element ref="BondExpirationDate" minOccurs="0"/>
                    <xs:element ref="RIN" minOccurs="0"/>
                    <xs:element ref="GST" minOccurs="0"/>
                    <xs:element ref="BusinessStartDate" minOccurs="0"/>
                    <xs:element ref="OutOfBusiness" minOccurs="0"/>
                    <xs:element ref="OutOfBusinessDate" minOccurs="0"/>
                    <xs:element ref="MembershipExpirationDate" minOccurs="0"/>
                    <xs:element ref="CommercialAccountType" minOccurs="0"/>
                    <xs:element ref="ParentCompanyID" minOccurs="0"/>
                    <xs:element ref="Courier" minOccurs="0"/>
                    <xs:element ref="CourierAccount" minOccurs="0"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="CompanyType">
            <xs:annotation>
                <xs:documentation>Indicates company's tax classification.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="Sole Proprietorship"/>
                    <xs:enumeration value="General Partnership"/>
                    <xs:enumeration value="Limited Partnership"/>
                    <xs:enumeration value="Sub C Corporation"/>
                    <xs:enumeration value="Sub S Corporation"/>
                    <xs:enumeration value="LLC-Sole"/>
                    <xs:enumeration value="LLC-Partnership"/>
                    <xs:enumeration value="LLC-Corporation"/>
                    <xs:enumeration value="Business Corporation"/>
                    <xs:enumeration value="Limited Liability Company"/>
                    <xs:enumeration value="Unlimited Liability Corporation"/>
                    <xs:enumeration value="Government Agency"/>
                    <xs:enumeration value="Unknown"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="Courier">
            <xs:annotation>
                <xs:documentation>Type of courier.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="No Courier"/>
                    <xs:enumeration value="Federal Express"/>
                    <xs:enumeration value="DHL"/>
                    <xs:enumeration value="United Parcel Service"/>
                    <xs:enumeration value="United States Postal Service"/>
                    <xs:enumeration value="Purolator"/>
                    <xs:enumeration value="Other"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="CourierAccount">
            <xs:annotation>
                <xs:documentation>Courier Account number and information.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="25"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="DBAName">
            <xs:annotation>
                <xs:documentation>Company's Doing Business As name.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="50"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="DunandBradstreetNumber">
            <xs:annotation>
                <xs:documentation>ID issued to company by Dun and Bradstreet</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="9"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="EntityType">
            <xs:annotation>
                <xs:documentation>Indicates kind of entity in message.  Note: The EntityType enumerations are consistent across all messages. The only values that pertain to this message are: Dealership and Commercial Account.  Transporter is a future enhancement and may or may not be relevant to this message in the future.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="Dealership"/>
                    <xs:enumeration value="Transporter"/>
                    <xs:enumeration value="Commercial Account"/>
                    <xs:enumeration value="Company Association"/>
                    <xs:enumeration value="Person"/>
                    <xs:enumeration value="Bank"/>
                    <xs:enumeration value="Bank Account"/>
                    <xs:enumeration value="Third Party Remarketing"/>
                    <xs:enumeration value="Customer Customization"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="GovernmentID">
            <xs:annotation>
                <xs:documentation>Unique id issued by government.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="50"/>
                    <xs:minLength value="1"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="GovernmentIDCountry">
            <xs:annotation>
                <xs:documentation>Issuing country of government id</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="50"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="GovernmentIDType">
            <xs:annotation>
                <xs:documentation>Indicates type of government id.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="GovtPersonalID"/>
                    <xs:enumeration value="GovtID"/>
                    <xs:enumeration value="Passport"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="GST">
            <xs:annotation>
                <xs:documentation>Goods and Services Tax number issued for Canadian companies.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:union>
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:pattern value="[0-9]{9}"/>
                        </xs:restriction>
                    </xs:simpleType>
                    <xs:simpleType>
                        <xs:restriction base="xs:token">
                            <xs:enumeration value=""/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:union>
            </xs:simpleType>
        </xs:element>
        <xs:element name="InsuranceCompany">
            <xs:annotation>
                <xs:documentation>Insurance company.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="75"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="InsuranceExpirationDate">
            <xs:annotation>
                <xs:documentation>Expiration date of insurance policy.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:union memberTypes="xs:date">
                    <xs:simpleType>
                        <xs:restriction base="xs:token">
                            <xs:enumeration value=""/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:union>
            </xs:simpleType>
        </xs:element>
        <xs:element name="LegalName">
            <xs:annotation>
                <xs:documentation>Legal Name of company based on licensing documents.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="50"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="MembershipExpirationDate">
            <xs:annotation>
                <xs:documentation>Expiration date for company's AutoTec membership.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:union memberTypes="xs:date">
                    <xs:simpleType>
                        <xs:restriction base="xs:token">
                            <xs:enumeration value=""/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:union>
            </xs:simpleType>
        </xs:element>
        <xs:element name="Message">
            <xs:complexType>
                <xs:sequence>
                    <xs:element ref="Header"/>
                    <xs:element ref="CompanyInformation"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="NICBNumber">
            <xs:annotation>
                <xs:documentation>ID issued to company by National Insurance Crime Bureau.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="9"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="OutOfBusiness">
            <xs:annotation>
                <xs:documentation>Indicates whether a company is out of business.  A 'Y' value will always be accompanied by an OutOfBusinessDate.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="Y"/>
                    <xs:enumeration value="N"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="OutOfBusinessDate">
            <xs:annotation>
                <xs:documentation>Date company went out of business.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:union memberTypes="xs:date">
                    <xs:simpleType>
                        <xs:restriction base="xs:token">
                            <xs:enumeration value=""/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:union>
            </xs:simpleType>
        </xs:element>
        <xs:element name="ParentCompanyID">
            <xs:annotation>
                <xs:documentation>The AutoTec id of any group of which the company is a member.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:int">
                    <xs:maxInclusive value="1200000000"/>
                    <xs:minInclusive value="1000000"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="PolicyNumber">
            <xs:annotation>
                <xs:documentation>Insurance policy number.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="50"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="PublicSaleOnly">
            <xs:annotation>
                <xs:documentation>Indicates company is allowed to purchase in public sales only.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="Y"/>
                    <xs:enumeration value="N"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
        <xs:element name="RIN">
            <xs:annotation>
                <xs:documentation>Registrant Identification Number issued by Canada to Ontario dealerships.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:union>
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:pattern value="[0-9]{9}"/>
                        </xs:restriction>
                    </xs:simpleType>
                    <xs:simpleType>
                        <xs:restriction base="xs:token">
                            <xs:enumeration value=""/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:union>
            </xs:simpleType>
        </xs:element>
</xs:schema>

人.xsd

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2009 sp1 (http://www.altova.com) by Charles Redden (AutoTec, LLC) -->
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:include schemaLocation="Header9.xsd"/>
    <xs:annotation>
        <xs:documentation>Person Message</xs:documentation>
    </xs:annotation>
    <xs:element name="CardSentToLocation">
        <xs:annotation>
            <xs:documentation>Location last card was mailed to</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:maxLength value="35"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="CardSequence">
        <xs:annotation>
            <xs:documentation>Sequence Number of currently active card.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:pattern value="[0-9]{1,2}"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="DateMostRecentCard">
        <xs:annotation>
            <xs:documentation>Date most recent card printed.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:union memberTypes="xs:date">
                <xs:simpleType>
                    <xs:restriction base="xs:token">
                        <xs:enumeration value=""/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:union>
        </xs:simpleType>
    </xs:element>
    <xs:element name="Deceased">
        <xs:annotation>
            <xs:documentation>Deceased status.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="Y"/>
                <xs:enumeration value="N"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="DOB">
        <xs:annotation>
            <xs:documentation>Date of Birth.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:union memberTypes="xs:date">
                <xs:simpleType>
                    <xs:restriction base="xs:token">
                        <xs:enumeration value=""/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:union>
        </xs:simpleType>
    </xs:element>
    <xs:element name="FirstName">
        <xs:annotation>
            <xs:documentation>Individual's first name.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:maxLength value="20"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="GovernmentID">
        <xs:annotation>
            <xs:documentation>Unique identification issued by government.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:maxLength value="25"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="GovernmentIDCountry">
        <xs:annotation>
            <xs:documentation>Issuing country of government ID.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:maxLength value="50"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="GovernmentIDType">
        <xs:annotation>
            <xs:documentation>Indicates type of government id.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="None"/>
                <xs:enumeration value="Social Security Number"/>
                <xs:enumeration value="Taxpayer Identification Number"/>
                <xs:enumeration value="CURP"/>
                <xs:enumeration value="Passport"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="IDVerificationScore" type="xs:int"/>
    <xs:element name="LanguagePreference">
        <xs:annotation>
            <xs:documentation>Preferred language for communication.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="English"/>
                <xs:enumeration value="Spanish"/>
                <xs:enumeration value="French"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="LastName">
        <xs:annotation>
            <xs:documentation>Individual's last name.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:maxLength value="30"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="MembershipExpirationDate">
        <xs:annotation>
            <xs:documentation>AutoTec renewal date for individual.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:union memberTypes="xs:date">
                <xs:simpleType>
                    <xs:restriction base="xs:token">
                        <xs:enumeration value=""/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:union>
        </xs:simpleType>
    </xs:element>
    <xs:element name="Message">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Header"/>
                <xs:element ref="PersonInformation"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="MiddleName">
        <xs:annotation>
            <xs:documentation>Individual's middle name.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:maxLength value="30"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="NickName">
        <xs:annotation>
            <xs:documentation>Individual's nickname.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:maxLength value="15"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="PersonID">
        <xs:annotation>
            <xs:documentation>AutoTec Individual ID.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:int">
                <xs:minInclusive value="100000001"/>
                <xs:maxInclusive value="199999999"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="PersonInformation">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="PersonID"/>
                <xs:element ref="FirstName"/>
                <xs:element minOccurs="0" ref="MiddleName"/>
                <xs:element ref="LastName"/>
                <xs:element minOccurs="0" ref="Prefix"/>
                <xs:element minOccurs="0" ref="Suffix"/>
                <xs:element ref="GovernmentID"/>
                <xs:element ref="GovernmentIDCountry"/>
                <xs:element minOccurs="0" ref="GovernmentIDType"/>
                <xs:element minOccurs="0" ref="DOB"/>
                <xs:element minOccurs="0" ref="DateMostRecentCard"/>
                <xs:element minOccurs="0" ref="CardSentToLocation"/>
                <xs:element minOccurs="0" ref="NickName"/>
                <xs:element ref="MembershipExpirationDate"/>
                <xs:element ref="Deceased"/>
                <xs:element ref="LanguagePreference"/>
                <xs:element minOccurs="0" ref="PublicSaleOnly"/>
                <xs:element minOccurs="0" ref="IDVerificationScore"/>
                <xs:element ref="CardSequence"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="Prefix">
        <xs:annotation>
            <xs:documentation>Individual's name prefix.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:maxLength value="10"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="PublicSaleOnly">
        <xs:annotation>
            <xs:documentation>Indicates individual may only purchase at a public sale.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="Y"/>
                <xs:enumeration value="N"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="Suffix">
        <xs:annotation>
            <xs:documentation>Individual's name suffix.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:maxLength value="10"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
</xs:schema>

pom.xml

<build>
        <plugins>
            <!-- Plugin required to build java classes from XSD using XJC -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>1.5</version>
                <dependencies>
                    <dependency>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-commons-lang</artifactId>
                        <version>2.3</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <packageName>com.sqs.dto</packageName>
                    <schemaDirectory>src/main/resources/xsd</schemaDirectory>
                    <arguments>-Xcommons-lang</arguments>
                </configuration>
            </plugin>

        </plugins>
    </build>

我需要一些解决方案。

更新:我尝试按如下方式添加绑定文件,但仍然出现相同的错误:PER.xjb

<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
               xmlns:xs="http://www.w3.org/2001/XMLSchema"
               version="2.1">
    <jaxb:bindings schemaLocation="../xsd/PER.xsd">
        <jaxb:bindings node="//xs:element[@name='GovernmentIDType']/xs:simpleType">
            <jaxb:property name="GovernmentIDTypePER" />
            <!--<jaxb:factoryMethod name="GovernmentIDTypePER"/>-->
        </jaxb:bindings>
        <jaxb:bindings node="//xs:element[@name='GovernmentID']/xs:simpleType">
            <jaxb:factoryMethod name="GovernmentIDPER"/>
            <!--<jaxb:property name="GovernmentIDPER" />-->
        </jaxb:bindings>
    </jaxb:bindings>
</jaxb:bindings>
4

0 回答 0