0

これは、JiBx で codegen とバインドに使用しているスキーマです。

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.abc.com/abc/service/APIService" targetNamespace="http://www.abc.com/abc/service/Service" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0">
<xs:include schemaLocation="OTA_AirLowFareSearchRQ.xsd"/>
<xs:include schemaLocation="OTA_AirLowFareSearchRS.xsd"/>
<xs:element name="APIRequest">
    <xs:complexType>
        <xs:sequence>
            <xs:element ref="OTA_AirLowFareSearchRQ"/>
        </xs:sequence>
        <xs:attribute name="version" type="xs:string" use="required"/>
        <xs:attribute name="bdmVersion" type="xs:string" use="required"/>
    </xs:complexType>
</xs:element>
<xs:element name="APIResponse">
    <xs:complexType>
        <xs:sequence>
            <xs:annotation>
                <xs:documentation xml:lang="en">All Schema files in the OTA specification are made available according to the terms defined by the OTA License Agreement at http://www.opentravel.org/ota_downloads_form.cfm</xs:documentation>
            </xs:annotation>
            <xs:element ref="OTA_AirLowFareSearchRS"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

これは、コードを生成しようとしたときに発生するエラーです。エラー codegen.CodeGen - エラー: 参照された要素 '{http://www.abc.com/abc/service/APIService}:OTA_AirLowFareSearchRQ' が '要素' に対して定義されていません (行 11、列 47、APIService.xsd 内) .

どんな助けでも大歓迎です。

4

1 に答える 1

0

ナラヤナン、

xml 名前空間が正しくありません。あなたのエラーメッセージは、何が間違っているかを示しています。OTA_AirLowFareSearchRQ は {http://www.opentravel.org/OTA/2003/05} 名前空間にあるため、'{http://www.abc.com/abc/service/APIService}:OTA_AirLowFareSearchRQ' は定義されていません。

修正は簡単です。正しい名前空間の要素を含めるか、スキーマを opentravel 名前空間に配置するだけです。修正されたスキーマ定義は次のとおりです。

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns="http://www.opentravel.org/OTA/2003/05"
 targetNamespace="http://www.abc.com/abc/service/Service"
 elementFormDefault="qualified"
 attributeFormDefault="unqualified"
 version="2.0">
<xs:include schemaLocation="http://www.opentravel.org/2011A/OTA_AirLowFareSearchRQ.xsd"/>
<xs:include schemaLocation="http://www.opentravel.org/2011A/OTA_AirLowFareSearchRS.xsd"/>
<xs:element name="APIRequest">
    <xs:complexType>
        <xs:sequence>
            <xs:element ref="OTA_AirLowFareSearchRQ"/>
        </xs:sequence>
        <xs:attribute name="version" type="xs:string" use="required"/>
        <xs:attribute name="bdmVersion" type="xs:string" use="required"/>
    </xs:complexType>
</xs:element>
<xs:element name="APIResponse">
    <xs:complexType>
        <xs:sequence>
            <xs:annotation>
                <xs:documentation xml:lang="en">All Schema files in the OTA specification are made available according to the terms defined by the OTA License Agreement at http://www.opentravel.org/ota_downloads_form.cfm</xs:documentation>
            </xs:annotation>
            <xs:element ref="OTA_AirLowFareSearchRS"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>
</xs:schema>

これを JiBX でテストしたところ、問題なく動作するはずです。

ドン

于 2011-09-20T17:30:28.903 に答える