以下回复来自Sabre TravelItineraryReadRQ
<ReservationItems>
<Item>
<FlightSegment>
<DestinationLocation>
<LocationCode>RUH</LocationCode>
<Terminal>TERMINAL 2</Terminal>
<TerminalCode>2</TerminalCode>
</DestinationLocation>
<Equipment>
<AirEquipType>320</AirEquipType>
</Equipment>
<MarketingAirline>
<Code>SV</Code>
<FlightNumber>0573</FlightNumber>
</MarketingAirline>
<Meal>
<Code>M</Code>
</Meal>
<OriginLocation>
<LocationCode>AUH</LocationCode>
<Terminal>TERMINAL 1</Terminal>
<TerminalCode>1</TerminalCode>
</OriginLocation>
<SupplierRef>
<ID>123</ID>
</SupplierRef>
<UpdatedArrivalTime>06-27T21:50</UpdatedArrivalTime>
<UpdatedDepartureTime>06-27T21:00</UpdatedDepartureTime>
<AirMilesFlown>0483</AirMilesFlown>
<ArrivalDateTime>06-27T21:50</ArrivalDateTime>
<ConnectionInd>O</ConnectionInd>
<DayOfWeekInd>6</DayOfWeekInd>
<DepartureDateTime>2015-06-27T21:00</DepartureDateTime>
<ElapsedTime>01.50</ElapsedTime>
<eTicket>false</eTicket>
<FlightNumber>0573</FlightNumber>
<NumberInParty>01</NumberInParty>
<ResBookDesigCode>V</ResBookDesigCode>
<SegmentNumber>0001</SegmentNumber>
<SmokingAllowed>false</SmokingAllowed>
<SpecialMeal>false</SpecialMeal>
<Status>HK</Status>
<StopQuantity>00</StopQuantity>
</FlightSegment>
<RPH>1</RPH>
</Item>
<Item>
<FlightSegment>
<DestinationLocation>
<LocationCode>LHR</LocationCode>
<Terminal>TERMINAL 4</Terminal>
<TerminalCode>4</TerminalCode>
</DestinationLocation>
<Equipment>
<AirEquipType>77W</AirEquipType>
</Equipment>
<MarketingAirline>
<Code>SV</Code>
<FlightNumber>0107</FlightNumber>
</MarketingAirline>
<Meal>
<Code>M</Code>
</Meal>
<OriginLocation>
<LocationCode>RUH</LocationCode>
<Terminal>TERMINAL 2</Terminal>
<TerminalCode>2</TerminalCode>
</OriginLocation>
<SupplierRef>
<ID>123</ID>
</SupplierRef>
<UpdatedArrivalTime>06-28T07:15</UpdatedArrivalTime>
<UpdatedDepartureTime>06-28T02:20</UpdatedDepartureTime>
<AirMilesFlown>3087</AirMilesFlown>
<ArrivalDateTime>06-28T07:15</ArrivalDateTime>
<ConnectionInd>I</ConnectionInd>
<DayOfWeekInd>7</DayOfWeekInd>
<DepartureDateTime>2015-06-28T02:20</DepartureDateTime>
<ElapsedTime>06.55</ElapsedTime>
<eTicket>false</eTicket>
<FlightNumber>0107</FlightNumber>
<NumberInParty>01</NumberInParty>
<ResBookDesigCode>V</ResBookDesigCode>
<SegmentNumber>0002</SegmentNumber>
<SmokingAllowed>false</SmokingAllowed>
<SpecialMeal>false</SpecialMeal>
<Status>HK</Status>
<StopQuantity>00</StopQuantity>
</FlightSegment>
<RPH>2</RPH>
</Item>
<Item>
<FlightSegment>
<DestinationLocation>
<LocationCode>RUH</LocationCode>
<Terminal>TERMINAL 2</Terminal>
<TerminalCode>2</TerminalCode>
</DestinationLocation>
<Equipment>
<AirEquipType>77W</AirEquipType>
</Equipment>
<MarketingAirline>
<Code>SV</Code>
<FlightNumber>0118</FlightNumber>
</MarketingAirline>
<Meal>
<Code>M</Code>
</Meal>
<OriginLocation>
<LocationCode>LHR</LocationCode>
<Terminal>TERMINAL 4</Terminal>
<TerminalCode>4</TerminalCode>
</OriginLocation>
<SupplierRef>
<ID>123</ID>
</SupplierRef>
<UpdatedArrivalTime>07-16T03:35</UpdatedArrivalTime>
<UpdatedDepartureTime>07-15T18:50</UpdatedDepartureTime>
<AirMilesFlown>3087</AirMilesFlown>
<ArrivalDateTime>07-16T03:35</ArrivalDateTime>
<ConnectionInd>O</ConnectionInd>
<DayOfWeekInd>3</DayOfWeekInd>
<DepartureDateTime>2015-07-15T18:50</DepartureDateTime>
<ElapsedTime>06.45</ElapsedTime>
<eTicket>false</eTicket>
<FlightNumber>0118</FlightNumber>
<NumberInParty>01</NumberInParty>
<ResBookDesigCode>V</ResBookDesigCode>
<SegmentNumber>0003</SegmentNumber>
<SmokingAllowed>false</SmokingAllowed>
<SpecialMeal>false</SpecialMeal>
<Status>HK</Status>
<StopQuantity>00</StopQuantity>
</FlightSegment>
<RPH>3</RPH>
</Item>
<Item>
<FlightSegment>
<DestinationLocation>
<LocationCode>AUH</LocationCode>
<Terminal>TERMINAL 1</Terminal>
<TerminalCode>1</TerminalCode>
</DestinationLocation>
<Equipment>
<AirEquipType>E70</AirEquipType>
</Equipment>
<MarketingAirline>
<Code>SV</Code>
<FlightNumber>0578</FlightNumber>
</MarketingAirline>
<Meal>
<Code>M</Code>
</Meal>
<OriginLocation>
<LocationCode>RUH</LocationCode>
<Terminal>TERMINAL 2</Terminal>
<TerminalCode>2</TerminalCode>
</OriginLocation>
<SupplierRef>
<ID>123</ID>
</SupplierRef>
<UpdatedArrivalTime>07-16T09:15</UpdatedArrivalTime>
<UpdatedDepartureTime>07-16T06:30</UpdatedDepartureTime>
<AirMilesFlown>0483</AirMilesFlown>
<ArrivalDateTime>07-16T09:15</ArrivalDateTime>
<ConnectionInd>I</ConnectionInd>
<DayOfWeekInd>4</DayOfWeekInd>
<DepartureDateTime>2015-07-16T06:30</DepartureDateTime>
<ElapsedTime>01.45</ElapsedTime>
<eTicket>false</eTicket>
<FlightNumber>0578</FlightNumber>
<NumberInParty>01</NumberInParty>
<ResBookDesigCode>V</ResBookDesigCode>
<SegmentNumber>0004</SegmentNumber>
<SmokingAllowed>false</SmokingAllowed>
<SpecialMeal>false</SpecialMeal>
<Status>HK</Status>
<StopQuantity>00</StopQuantity>
</FlightSegment>
<RPH>4</RPH>
</Item>
</ReservationItems>
从上面的回复我想识别返回和前进段。 Rph = 1,2是向前和 Rph = 3,4是Retrun。
当我从PNR阅读这些信息时,我需要一种识别这些信息的方法。 所以我无法将它与任何其他请求进行比较。
我不是在寻找代码来执行此操作,我在询问是否有人知道Saber,是否有办法获得带有一些标识符的响应以识别Onward和Return,例如 MarriageGrp 。
答案 0 :(得分:0)
我知道这个问题可能已经过时了,但是我看到它并且我认为我应该回答它,因为它可以帮助其他人(如果你已经找到了解决方法),因为没有像 MarriageGrp 或其他任何
这是我要去的流程。
1. When a user searches, save the route information in a table say (Lhr->DXB->Lhr)
2. When the user picks an itinerary from the result and you submit the details to EnhancedAirbook, you get that ReservationItem node which is not grouped (like they were under OriginDestionationOptions in OTA_AILOW
3. The next step is pretty important.
a. Extract out all the destionations (in this case it would be DXB,LHR) into a variable say $paxDestLocations; Also we will have a variable say $FlightLegs - that will hold the Legs and the FlightSegments in each legs.
If there are no more ReservationItems, then you are done. If there are more, then goto C.
c. Let $totalSegments = count($reservationItems);
$usedSegmentsCounter = 0; // Will help know how much of ReservationItems we have used.
Start a loop like the below..
// $i will represent each leg of the flight.
// $pL will equal total destinations
// $pL = count($paxDestLocations);
for ($i=0; $i<= $pL-1; $i++){
$FlightLeg[$i]['FlightSegments'] = [];
// We wana start counting from usedSegmentsCounter
$s = $usedSegmentsCounter ;
for ($j=$s; $j<=$totalSegments-1; $j++){
// If we just started assigning segments for this leg, then just give the first segment to this leg, we will deal with the other segments in the else block..
if(empty($FlightLeg[$i]['FlightSegments'])){
$FlightLeg[$i]['FlightSegments'] = $reservationItems[$j];
}
# Pick the segment..and just add it to the current leg
else{
$FlightLeg[$i]['FlightSegments'][count($FlightLeg[$i]['FlightSegments'])] = $reservationItems[$j];
}
// And below, we check if the current flight segment's destinationCode matched the destionationCode we are currently in..
if($reservationItem[$j]['FlightSegment']['DestinationLocation']['LocationCode'] == $paxDestLocations[$i]){
// We are done with the segments in this leg,
break 2;
}
}
}
At the end of this loop, you will have an array of this Structure below:
$FlightLeg = [
// Leg 1
[
['FlightSegents' = [
[ // ReservationItem 1],
[ // ReservationItem 2]
]
],
// Leg 2
[
['FlightSegents' = [
[ // ReservationItem 1],
[ // ReservationItem 2]
]
],
]
我知道你说你不是在寻找代码 - 但我想使用上面的代码块更容易解释。
答案 1 :(得分:-1)
试试这个。代码非常简单
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace ConsoleApplication2
{
class Program
{
const string FILENAME = @"c:\temp\test.xml";
static void Main(string[] args)
{
XDocument doc = XDocument.Load(FILENAME);
var results = doc.Descendants("Item")
.Select(x => new { rph = x.Elements("RPH").FirstOrDefault().Value,
flight = x.Descendants("FlightNumber").FirstOrDefault().Value
})
.ToList();
}
}
}