绑定maven-jaxb2-plugin:解析架构时出错

时间:2019-03-10 19:44:53

标签: binding xsd schema maven-jaxb2-plugin

案例

我尝试进行绑定以避免元素中Ancillaries.1.14.0.xsdPNRBuilderTypes_v1.19.0.xsd之间的冲突:

<xsd:simpleType name="_flightNumberLiterals">. 

任何建议都值得欢迎。谢谢!

错误

[ERROR] Error while parsing schema(s).
Location [ file:test.jxb{10,55}].
com.sun.istack.SAXParseException2; 
systemId: file:test.jxb; 
lineNumber: 10; columnNumber: 55; 
el compilador no ha podido mantener esta personalización de class. 
Está asociada a un lugar incorrecto o es inconsistente con otros enlaces.
at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:86)
at com.sun.tools.xjc.reader.xmlschema.ErrorReporter.error(ErrorReporter.java:84)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.check(UnusedCustomizationChecker.java:149)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.check(UnusedCustomizationChecker.java:127)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.simpleType(UnusedCustomizationChecker.java:240)

test.jxb

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings version="2.0" 
       xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
       xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" 
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

<jaxb:bindings schemaLocation="Ancillaries.1.14.0.xsd" node="/xsd:schema">
    <jaxb:bindings node="//xsd:schema/xsd:simpleType[@name='_flightNumberLiterals']">
        <jaxb:class name="FlightNumberLiterals1"/>
    </jaxb:bindings>
</jaxb:bindings>

Ancillaries.1.14.0.xsd

<xsd:schema targetNamespace="http://services.sabre.com/res/or/v1_14" elementFormDefault="qualified" attributeFormDefault="unqualified" jaxb:version="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://services.sabre.com/res/or/v1_14" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
...  
    <xsd:simpleType name="FlightNumber">
        <xsd:annotation>
            <xsd:documentation>Identifies a flight number ... 
            </xsd:documentation>
        </xsd:annotation>
        <xsd:union memberTypes="_flightNumberPattern _flightNumberLiterals"/>
    </xsd:simpleType>
    <xsd:simpleType name="_flightNumberPattern">
        <xsd:annotation>
            <xsd:documentation>This private simple ...</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="[0-9]{1,4}[A-Z]?"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="_flightNumberLiterals">
        <xsd:annotation>
            <xsd:documentation>This private type ...</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="OPEN"/>
            <xsd:enumeration value="ARNK"/>
        </xsd:restriction>
    </xsd:simpleType>
...
</xsd:schema>

PNRBuilderTypes_v1.19.0.xsd

<xsd:schema ... >
    ...
    <xsd:simpleType name="_flightNumberLiterals">
        <xsd:annotation>
          <xsd:documentation>This private type ...</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
          <xsd:enumeration value="OPEN"/>
          <xsd:enumeration value="ARNK"/>
        </xsd:restriction>
    </xsd:simpleType>
    ...
</xsd:schema>

maven-jaxb2-plugin

<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>

0 个答案:

没有答案