我使用 JAXB 从 XSD 生成 Java 类,JAXB 无法从包含的 xsd 中识别组元素,简单元素可以正常工作。错误:org.xml.sax.SAXParseException:未定义的简单或复杂类型
<?xml version="1.0" encoding="UTF-8"?>
<!-- Schema for itinerary response -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.cleartrip.com/air/" xmlns:air="http://www.cleartrip.com/air/">
<xs:include schemaLocation="air-common.xsd"/>
***<xs:element name="itinerary" type="air:TripType"/>***
</xs:schema>
air-common.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://www.cleartrip.com/air/"
xmlns:air="http://www.cleartrip.com/air/">
<xs:simpleType name="NameType">
<xs:annotation>
<xs:documentation>Defining a type for a name</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="27"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="AirportCodeType">
<xs:annotation>
<xs:documentation>Airport codes</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z0-9]{3}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PhoneNumberType">
<xs:annotation>
<xs:documentation>Phone numbers</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
***<xs:group name="TripType">
<xs:annotation>
<xs:documentation>Trip type -- used to display an itinerary or trip</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element minOccurs="0" ref="air:trip-id"/>
<xs:element minOccurs="0" ref="air:created-at"/>
<xs:element ref="air:pricing-summary"/>
<xs:element ref="air:flights"/>
<xs:element ref="air:pax-pricing-info-list"/>
<xs:element ref="air:pax-info-list"/>
<xs:element ref="air:contact-detail"/>
<xs:group minOccurs="0" ref="air:PaymentDetailResponse"/>
<xs:element minOccurs="0" ref="air:ancillary-data"/>
</xs:sequence>
</xs:group>***
</xs:schema>
代码生成适用于所有简单类型,问题仅在于 xs:group name="TripType",可能是什么问题。