0
我正在從薩翁(WSDL Web服務)客戶端的響應,薩翁響應無法轉換爲正確的XML
:departure_airport=>{:@location_code=>"MAA", :@code_context=>"IATA"}
當我嘗試轉換response.to_xml
,我得到
預期輸出:
我想這個迴應正確的XML,如果@意思,它應該是屬性,否則innexText
<departure_airport location_code="MAA" code_context="IATA" />
實際輸出:
<departure_airport>
<location_code>MAA</location_code>
<code_context>IATA</code_context>
</departure_airport>
幫助我獲得的實際響應。我正在使用Nokogiri來解析XML響應。
完全響應:
[{: flight_segment => {: departure_airport => {: @location_code => "MAA", : @code_context => "IATA"
}, : arrival_airport => {: @location_code => "DEL", : @code_context => "IATA"
}, : operating_airline => "JetLite India", : equipment => "73G", : marketing_airline => "JetLite India", : requested_cabin => {: @cabin_type => "Economy"
}, : booking_class_avails => {: booking_class_avail => {: @res_book_desig_code => "O", : @res_book_desig_quantity => "9"
}, : @cabin_type => "Economy"
}, : stop_location => {: @location_code => "BLR", : @code_context => "iata"
}, : @departure_date_time => "2014-10-10T08:20:00", : @arrival_date_time => "2014-10-10T12:30:00", : @stop_quantity => "1", : @flight_number => "4607", : @res_book_desig_code => "O", : @departure_day => "Fri"
}, : booking_reference_id => {: company_name => "Amadeus", : @type => "5", : @id => "1", : @id_context => "1A", : @sell_reference => "CPTS128TS", : @ticket_reference => "CPTS12801"
}, : @ts_duration => "15000000", : @ref_number => "1"
}, {: flight_segment => {: departure_airport => {: @location_code => "DEL", : @code_context => "IATA"
}, : arrival_airport => {: @location_code => "MAA", : @code_context => "IATA"
}, : operating_airline => "Jet Airways", : equipment => "73G", : marketing_airline => "Jet Airways", : requested_cabin => {: @cabin_type => "Economy"
}, : booking_class_avails => {: booking_class_avail => {: @res_book_desig_code => "O", : @res_book_desig_quantity => "9"
}, : @cabin_type => "Economy"
}, : stop_location => {: @location_code => "BLR", : @code_context => "iata"
}, : @departure_date_time => "2014-10-10T17:00:00", : @arrival_date_time => "2014-10-10T21:10:00", : @stop_quantity => "1", : @flight_number => "7075", : @res_book_desig_code => "O", : @departure_day => "Fri"
}, : booking_reference_id => {: company_name => "Amadeus", : @type => "5", : @id => "2", : @id_context => "1A", : @sell_reference => "CPTS128TS", : @ticket_reference => "CPTS12801"
}, : @ts_duration => "15000000", : @ref_number => "2"
}]
什麼是確切的響應格式或張貼類似的參考 – Bijendra 2014-10-09 08:00:39
@Bijendra我發佈了完整的答覆。 – 2014-10-09 08:55:54