0
我有以下XML文件 我想檢索一些值。 TH的問題,我試圖使用x路徑,但它沒有奏效。PHP訪問複雜的XML元素
下面是XML文件:
<soap-env:Envelope>
<soap-env:Header></soap-env:Header>
<soap-env:Body>
<OTA_AirAvailRS Version="2.2.0">
<stl:ApplicationResults status="Complete"></stl:ApplicationResults>
<OriginDestinationOptions OriginTimeZone="Z2">
<OriginDestinationOption RPH="1">
<FlightSegment ArrivalDateTime="01-05T01:05" DOT_Ind="N" DepartureDateTime="01-04T22:00" FlightNumber="642" RPH="1" SmokingAllowed="false" StopQuantity="0" eTicket="true">
<BookingClassAvail Availability="9" RPH="1" ResBookDesigCode="J" />
<BookingClassAvail Availability="0" RPH="2" ResBookDesigCode="Z" />
<BookingClassAvail Availability="5" RPH="3" ResBookDesigCode="C" />
<BookingClassAvail Availability="4" RPH="4" ResBookDesigCode="D" />
<BookingClassAvail Availability="0" RPH="5" ResBookDesigCode="I" />
<BookingClassAvail Availability="9" RPH="6" ResBookDesigCode="Y" />
<BookingClassAvail Availability="9" RPH="7" ResBookDesigCode="B" />
<BookingClassAvail Availability="0" RPH="8" ResBookDesigCode="P" />
<BookingClassAvail Availability="9" RPH="9" ResBookDesigCode="H" />
<BookingClassAvail Availability="0" RPH="10" ResBookDesigCode="W" />
<BookingClassAvail Availability="9" RPH="11" ResBookDesigCode="K" />
<BookingClassAvail Availability="0" RPH="12" ResBookDesigCode="R" />
<BookingClassAvail Availability="9" RPH="13" ResBookDesigCode="M" />
<BookingClassAvail Availability="9" RPH="14" ResBookDesigCode="L" />
<BookingClassAvail Availability="9" RPH="15" ResBookDesigCode="V" />
<BookingClassAvail Availability="9" RPH="16" ResBookDesigCode="S" />
<BookingClassAvail Availability="9" RPH="17" ResBookDesigCode="N" />
<BookingClassAvail Availability="9" RPH="18" ResBookDesigCode="Q" />
<BookingClassAvail Availability="9" RPH="19" ResBookDesigCode="O" />
<DaysOfOperation>
<OperationSchedule>
<OperationTimes>
<OperationTime Fri="true" Mon="false" Sat="true" Sun="true" Thur="false" Tue="false" Weds="true" />
</OperationTimes>
</OperationSchedule>
</DaysOfOperation>
<DestinationLocation LocationCode="KWI" />
<Equipment AirEquipType="E95" />
<FlightDetails Canceled="false" Charter="false" />
<MarketingAirline Code="RJ" FlightNumber="642" ParticipationLevel="DCA" />
<Meal MealCode="D" />
<OriginLocation LocationCode="AMM" />
</FlightSegment>
<FlightSegment ArrivalDateTime="01-05T06:10" ConnectionInd="Y" DOT_Ind="N" DepartureDateTime="01-05T03:25" FlightNumber="859" RPH="2" SmokingAllowed="false" StopQuantity="0" eTicket="true"></FlightSegment>
<FlightSegment ArrivalDateTime="01-05T12:30" ConnectionInd="Y" DOT_Ind="N" DepartureDateTime="01-05T10:20" FlightNumber="501" RPH="3" SmokingAllowed="false" StopQuantity="0" eTicket="true"></FlightSegment>
</OriginDestinationOption>
<OriginDestinationOption RPH="2"></OriginDestinationOption>
<OriginDestinationOption RPH="3"></OriginDestinationOption>
<OriginDestinationOption RPH="4"></OriginDestinationOption>
</OriginDestinationOptions>
</OTA_AirAvailRS>
</soap-env:Body>
</soap-env:Envelope>
我想找回提前
感謝從「航段」元素的值!
你試過了什麼? –