我在 SOAP API 的响应中得到了下面的 XML 字符串,我想将其转换为对象或数组来使用,所以我尝试了两种方法,DOM 和 simplexml_load_string 但它显示为空!
这是XML
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body xmlns="http://www.opentravel.org/OTA/2003/05"><OTA_AirAvailRS EchoToken="1717127940" PrimaryLangID="en-us" RetransmissionIndicator="false" SequenceNmbr="1" TransactionIdentifier="TID$171712797619728342-19C.de1191" Version="2006.01"><Success /><Warnings /><OriginDestinationInformation SameAirportInd="false"><DepartureDateTime CrossDateAllowedIndicator="false">2024-06-05T07:00:00</DepartureDateTime><ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-05T08:55:00</ArrivalDateTime><OriginLocation AlternateLocationInd="false" LocationCode="KHI" MultiAirportCityInd="false">Karachi</OriginLocation><DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</DestinationLocation><OriginDestinationOptions><OriginDestinationOption><FlightSegment ArrivalDateTime="2024-06-05T08:55:00" DepartureDateTime="2024-06-05T07:00:00" FlightNumber="9P670" JourneyDuration="PT1H55M0.000S" RPH="9P$KHI/ISB$12249$20240605070000$20240605085500" SmokingAllowed="false" returnFlag="false"><DepartureAirport LocationCode="KHI" Terminal="" /><ArrivalAirport LocationCode="ISB" Terminal="" /></FlightSegment></OriginDestinationOption></OriginDestinationOptions></OriginDestinationInformation><OriginDestinationInformation SameAirportInd="false"><DepartureDateTime CrossDateAllowedIndicator="false">2024-06-05T15:25:00</DepartureDateTime><ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-05T17:20:00</ArrivalDateTime><OriginLocation AlternateLocationInd="false" LocationCode="KHI" MultiAirportCityInd="false">Karachi</OriginLocation><DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</DestinationLocation><OriginDestinationOptions><OriginDestinationOption><FlightSegment ArrivalDateTime="2024-06-05T17:20:00" DepartureDateTime="2024-06-05T15:25:00" FlightNumber="9P672" JourneyDuration="PT1H55M0.000S" RPH="9P$KHI/ISB$12459$20240605152500$20240605172000" SmokingAllowed="false" returnFlag="false"><DepartureAirport LocationCode="KHI" Terminal="" /><ArrivalAirport LocationCode="ISB" Terminal="" /></FlightSegment></OriginDestinationOption></OriginDestinationOptions></OriginDestinationInformation><OriginDestinationInformation SameAirportInd="false"><DepartureDateTime CrossDateAllowedIndicator="false">2024-06-05T18:20:00</DepartureDateTime><ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-05T20:15:00</ArrivalDateTime><OriginLocation AlternateLocationInd="false" LocationCode="KHI" MultiAirportCityInd="false">Karachi</OriginLocation><DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</DestinationLocation><OriginDestinationOptions><OriginDestinationOption><FlightSegment ArrivalDateTime="2024-06-05T20:15:00" DepartureDateTime="2024-06-05T18:20:00" FlightNumber="9P674" JourneyDuration="PT1H55M0.000S" RPH="9P$KHI/ISB$9939$20240605182000$20240605201500" SmokingAllowed="false" returnFlag="false"><DepartureAirport LocationCode="KHI" Terminal="" /><ArrivalAirport LocationCode="ISB" Terminal="" /></FlightSegment></OriginDestinationOption></OriginDestinationOptions></OriginDestinationInformation><OriginDestinationInformation SameAirportInd="false"><DepartureDateTime CrossDateAllowedIndicator="false">2024-06-05T09:00:00</DepartureDateTime><ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-05T13:05:00</ArrivalDateTime><OriginLocation AlternateLocationInd="false" LocationCode="SHJ" MultiAirportCityInd="false">SHARJAH INTERNATIONAL AIRPORT</OriginLocation><DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</DestinationLocation><OriginDestinationOptions><OriginDestinationOption><FlightSegment ArrivalDateTime="2024-06-05T13:05:00" DepartureDateTime="2024-06-05T09:00:00" FlightNumber="9P741" JourneyDuration="PT3H5M0.000S" RPH="9P$SHJ/ISB$9302$20240605090000$20240605130500" SmokingAllowed="false" returnFlag="false"><DepartureAirport LocationCode="SHJ" Terminal="" /><ArrivalAirport LocationCode="ISB" Terminal="" /></FlightSegment></OriginDestinationOption></OriginDestinationOptions></OriginDestinationInformation><OriginDestinationInformation SameAirportInd="false"><DepartureDateTime CrossDateAllowedIndicator="false">2024-06-05T23:30:00</DepartureDateTime><ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-06T03:35:00</ArrivalDateTime><OriginLocation AlternateLocationInd="false" LocationCode="SHJ" MultiAirportCityInd="false">SHARJAH INTERNATIONAL AIRPORT</OriginLocation><DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</DestinationLocation><OriginDestinationOptions><OriginDestinationOption><FlightSegment ArrivalDateTime="2024-06-06T03:35:00" DepartureDateTime="2024-06-05T23:30:00" FlightNumber="9P743" JourneyDuration="PT3H5M0.000S" RPH="9P$SHJ/ISB$9722$20240605233000$20240606033500" SmokingAllowed="false" returnFlag="false"><DepartureAirport LocationCode="SHJ" Terminal="" /><ArrivalAirport LocationCode="ISB" Terminal="" /></FlightSegment></OriginDestinationOption></OriginDestinationOptions></OriginDestinationInformation><OriginDestinationInformation SameAirportInd="false"><DepartureDateTime CrossDateAllowedIndicator="false">2024-06-06T09:00:00</DepartureDateTime><ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-06T13:05:00</ArrivalDateTime><OriginLocation AlternateLocationInd="false" LocationCode="SHJ" MultiAirportCityInd="false">SHARJAH INTERNATIONAL AIRPORT</OriginLocation><DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</DestinationLocation><OriginDestinationOptions><OriginDestinationOption><FlightSegment ArrivalDateTime="2024-06-06T13:05:00" DepartureDateTime="2024-06-06T09:00:00" FlightNumber="9P741" JourneyDuration="PT3H5M0.000S" RPH="9P$SHJ/ISB$9303$20240606090000$20240606130500" SmokingAllowed="false" returnFlag="false"><DepartureAirport LocationCode="SHJ" Terminal="" /><ArrivalAirport LocationCode="ISB" Terminal="" /></FlightSegment></OriginDestinationOption></OriginDestinationOptions></OriginDestinationInformation><AAAirAvailRSExt><PricedItineraries><PricedItinerary SequenceNumber="1"><AirItinerary><OriginDestinationOptions><OriginDestinationOption><FlightSegment ArrivalDateTime="2024-06-05T17:20:00" DepartureDateTime="2024-06-05T15:25:00" FlightNumber="9P672" RPH="9P$KHI/ISB$12459$20240605152500$20240605172000" returnFlag="false"><DepartureAirport LocationCode="KHI" Terminal="" /><ArrivalAirport LocationCode="ISB" Terminal="" /></FlightSegment></OriginDestinationOption><AABundledServiceExt applicableOnd="KHI/ISB" applicableOndSequence="0"><bundledService><bunldedServiceId>147</bunldedServiceId><bundledServiceName>Value</bundledServiceName><perPaxBundledFee>1800.00</perPaxBundledFee><bookingClasses>Y5</bookingClasses><description>10 Kg Carry-on Baggage
23 Kg Checked Baggage
Sandwich with Soft Drinks
Free Seat (row 8 onwards)
Free Modification (One Up to 24h)</description><includedServies>BAGGAGE</includedServies><includedServies>SEAT_MAP</includedServies><includedServies>MEAL</includedServies><includedServies>FLEXI_CHARGES</includedServies></bundledService><bundledService><bunldedServiceId>46</bunldedServiceId><bundledServiceName>Ultimate</bundledServiceName><perPaxBundledFee>2900.00</perPaxBundledFee><bookingClasses>Y5</bookingClasses><description>10 Kg Carry-on Baggage
46 Kg Checked Baggage
Premium Meal, Desert and Salad
Any Seat – Including Front Row
2 Free Modification (Up to 6h)
1 Free Cancellation (Up to 6h)
Priority Check-in
50% Cash Refund* (Up to 24h)</description><includedServies>BAGGAGE</includedServies><includedServies>SEAT_MAP</includedServies><includedServies>MEAL</includedServies><includedServies>AIRPORT_SERVICE</includedServies><includedServies>FLEXI_CHARGES</includedServies></bundledService></AABundledServiceExt></OriginDestinationOptions></AirItinerary><AirItineraryPricingInfo PricingSource="Published"><ItinTotalFare NegotiatedFare="false"><BaseFare Amount="17855.00" CurrencyCode="PKR" DecimalPlaces="2" /><EquiBaseFare Amount="17855.00" CurrencyCode="PKR" DecimalPlaces="2" /><TotalFare Amount="20000.00" CurrencyCode="PKR" DecimalPlaces="2" /><TotalEquivFare Amount="20000.00" CurrencyCode="PKR" DecimalPlaces="2" /><TotalFareWithCCFee Amount="20000.00" CurrencyCode="PKR" DecimalPlaces="2" /><TotalEquivFareWithCCFee Amount="20000.00" CurrencyCode="PKR" DecimalPlaces="2" /></ItinTotalFare><PTC_FareBreakdowns><PTC_FareBreakdown PricingSource="Published"><PassengerTypeQuantity Age="0" Code="ADT" Quantity="1" /><FareBasisCodes><FareBasisCode>P</FareBasisCode></FareBasisCodes><PassengerFare NegotiatedFare="false"><BaseFare Amount="17855.00" CurrencyCode="PKR" DecimalPlaces="2" /><EquiBaseFare Amount="17855.00" CurrencyCode="PKR" DecimalPlaces="2" /><Taxes><Tax Amount="25.00" CurrencyCode="PKR" DecimalPlaces="2" TaxCode="N9DOM" TaxName="Pakistan DOM Stamp Duty (N9)" /><Tax Amount="500.00" CurrencyCode="PKR" DecimalPlaces="2" TaxCode="SPDOM" TaxName="Pakistan DOM Embarkation Fee (SP)" /><Tax Amount="100.00" CurrencyCode="PKR" DecimalPlaces="2" TaxCode="XZDOM" TaxName="Pakistan DOM Security Charge (XZ)" /><Tax Amount="20.00" CurrencyCode="PKR" DecimalPlaces="2" TaxCode="YIDOM" TaxName="Pakistan DOM Government Airport Tax (YI)" /><Tax Amount="1500.00" CurrencyCode="PKR" DecimalPlaces="2" TaxCode="PKDOM" TaxName="Pakistan DOM Excise Duty (PK)" /></Taxes><Fees /><TotalFare Amount="20000.00" CurrencyCode="PKR" DecimalPlaces="2" /></PassengerFare><TravelerRefNumber RPH="A1" /></PTC_FareBreakdown></PTC_FareBreakdowns></AirItineraryPricingInfo></PricedItinerary></PricedItineraries></AAAirAvailRSExt><Errors /></OTA_AirAvailRS></soap:Body></soap:Envelope>
我首先尝试了simplexml_load_string,如下所示,但它只显示空
$parser = simplexml_load_string($txt, "SimpleXMLElement", LIBXML_NOCDATA);
$responseFormat = $parser->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children()->OTA_AirAvailRS;
var_dump($responseFormat);
然后我尝试了 DOM 对象,如下所示
$xml = new DOMDocument();
$xml->loadXML ($txt);
$xml->xinclude();
$xml = simplexml_import_dom($xml);
var_dump($xml);
也尝试了以下操作,如其他 Stack Over 流程问题中所见,但仍然没有好运。
$domDocument = new DOMDocument();
$domDocument->loadXML($result);
$parser=$domDocument->getElementsByTagNameNS("http://www.opentravel.org/OTA/2003/05", "OTA_AirAvailRS");
var_dump($parser);
不替换 NS2 原始 XML 如下,但我使用 str_replace 替换了 NS1
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body xmlns:ns1="http://www.opentravel.org/OTA/2003/05">
<ns1:OTA_AirAvailRS EchoToken="11868765275150-1300255654" PrimaryLangID="en-us" RetransmissionIndicator="false" SequenceNmbr="1" TransactionIdentifier="TID$171712020644794-95.de1191" Version="2006.01">
<ns1:Success />
<ns1:Warnings />
<ns1:OriginDestinationInformation SameAirportInd="false">
<ns1:DepartureDateTime CrossDateAllowedIndicator="false">2024-06-15T07:00:00</ns1:DepartureDateTime>
<ns1:ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-15T08:55:00</ns1:ArrivalDateTime>
<ns1:OriginLocation AlternateLocationInd="false" LocationCode="KHI" MultiAirportCityInd="false">Karachi</ns1:OriginLocation>
<ns1:DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</ns1:DestinationLocation>
<ns1:OriginDestinationOptions>
<ns1:OriginDestinationOption>
<ns1:FlightSegment ArrivalDateTime="2024-06-15T08:55:00" DepartureDateTime="2024-06-15T07:00:00" FlightNumber="9P670" JourneyDuration="PT1H55M0.000S" RPH="9P$KHI/ISB$12259$20240615070000$20240615085500" SmokingAllowed="false" returnFlag="false">
<ns1:DepartureAirport LocationCode="KHI" Terminal="" />
<ns1:ArrivalAirport LocationCode="ISB" Terminal="" />
</ns1:FlightSegment>
</ns1:OriginDestinationOption>
</ns1:OriginDestinationOptions>
</ns1:OriginDestinationInformation>
<ns1:OriginDestinationInformation SameAirportInd="false">
<ns1:DepartureDateTime CrossDateAllowedIndicator="false">2024-06-15T15:25:00</ns1:DepartureDateTime>
<ns1:ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-15T17:20:00</ns1:ArrivalDateTime>
<ns1:OriginLocation AlternateLocationInd="false" LocationCode="KHI" MultiAirportCityInd="false">Karachi</ns1:OriginLocation>
<ns1:DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</ns1:DestinationLocation>
<ns1:OriginDestinationOptions>
<ns1:OriginDestinationOption>
<ns1:FlightSegment ArrivalDateTime="2024-06-15T17:20:00" DepartureDateTime="2024-06-15T15:25:00" FlightNumber="9P672" JourneyDuration="PT1H55M0.000S" RPH="9P$KHI/ISB$12469$20240615152500$20240615172000" SmokingAllowed="false" returnFlag="false">
<ns1:DepartureAirport LocationCode="KHI" Terminal="" />
<ns1:ArrivalAirport LocationCode="ISB" Terminal="" />
</ns1:FlightSegment>
</ns1:OriginDestinationOption>
</ns1:OriginDestinationOptions>
</ns1:OriginDestinationInformation>
<ns1:OriginDestinationInformation SameAirportInd="false">
<ns1:DepartureDateTime CrossDateAllowedIndicator="false">2024-06-15T18:20:00</ns1:DepartureDateTime>
<ns1:ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-15T20:15:00</ns1:ArrivalDateTime>
<ns1:OriginLocation AlternateLocationInd="false" LocationCode="KHI" MultiAirportCityInd="false">Karachi</ns1:OriginLocation>
<ns1:DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</ns1:DestinationLocation>
<ns1:OriginDestinationOptions>
<ns1:OriginDestinationOption>
<ns1:FlightSegment ArrivalDateTime="2024-06-15T20:15:00" DepartureDateTime="2024-06-15T18:20:00" FlightNumber="9P674" JourneyDuration="PT1H55M0.000S" RPH="9P$KHI/ISB$9949$20240615182000$20240615201500" SmokingAllowed="false" returnFlag="false">
<ns1:DepartureAirport LocationCode="KHI" Terminal="" />
<ns1:ArrivalAirport LocationCode="ISB" Terminal="" />
</ns1:FlightSegment>
</ns1:OriginDestinationOption>
</ns1:OriginDestinationOptions>
</ns1:OriginDestinationInformation>
<ns1:OriginDestinationInformation SameAirportInd="false">
<ns1:DepartureDateTime CrossDateAllowedIndicator="false">2024-06-15T09:00:00</ns1:DepartureDateTime>
<ns1:ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-15T13:05:00</ns1:ArrivalDateTime>
<ns1:OriginLocation AlternateLocationInd="false" LocationCode="SHJ" MultiAirportCityInd="false">SHARJAH INTERNATIONAL AIRPORT</ns1:OriginLocation>
<ns1:DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</ns1:DestinationLocation>
<ns1:OriginDestinationOptions>
<ns1:OriginDestinationOption>
<ns1:FlightSegment ArrivalDateTime="2024-06-15T13:05:00" DepartureDateTime="2024-06-15T09:00:00" FlightNumber="9P741" JourneyDuration="PT3H5M0.000S" RPH="9P$SHJ/ISB$9312$20240615090000$20240615130500" SmokingAllowed="false" returnFlag="false">
<ns1:DepartureAirport LocationCode="SHJ" Terminal="" />
<ns1:ArrivalAirport LocationCode="ISB" Terminal="" />
</ns1:FlightSegment>
</ns1:OriginDestinationOption>
</ns1:OriginDestinationOptions>
</ns1:OriginDestinationInformation>
<ns1:OriginDestinationInformation SameAirportInd="false">
<ns1:DepartureDateTime CrossDateAllowedIndicator="false">2024-06-15T23:30:00</ns1:DepartureDateTime>
<ns1:ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-16T03:35:00</ns1:ArrivalDateTime>
<ns1:OriginLocation AlternateLocationInd="false" LocationCode="SHJ" MultiAirportCityInd="false">SHARJAH INTERNATIONAL AIRPORT</ns1:OriginLocation>
<ns1:DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</ns1:DestinationLocation>
<ns1:OriginDestinationOptions>
<ns1:OriginDestinationOption>
<ns1:FlightSegment ArrivalDateTime="2024-06-16T03:35:00" DepartureDateTime="2024-06-15T23:30:00" FlightNumber="9P743" JourneyDuration="PT3H5M0.000S" RPH="9P$SHJ/ISB$9732$20240615233000$20240616033500" SmokingAllowed="false" returnFlag="false">
<ns1:DepartureAirport LocationCode="SHJ" Terminal="" />
<ns1:ArrivalAirport LocationCode="ISB" Terminal="" />
</ns1:FlightSegment>
</ns1:OriginDestinationOption>
</ns1:OriginDestinationOptions>
</ns1:OriginDestinationInformation>
<ns1:OriginDestinationInformation SameAirportInd="false">
<ns1:DepartureDateTime CrossDateAllowedIndicator="false">2024-06-16T09:00:00</ns1:DepartureDateTime>
<ns1:ArrivalDateTime CrossDateAllowedIndicator="false">2024-06-16T13:05:00</ns1:ArrivalDateTime>
<ns1:OriginLocation AlternateLocationInd="false" LocationCode="SHJ" MultiAirportCityInd="false">SHARJAH INTERNATIONAL AIRPORT</ns1:OriginLocation>
<ns1:DestinationLocation AlternateLocationInd="false" LocationCode="ISB" MultiAirportCityInd="false">Islamabad</ns1:DestinationLocation>
<ns1:OriginDestinationOptions>
<ns1:OriginDestinationOption>
<ns1:FlightSegment ArrivalDateTime="2024-06-16T13:05:00" DepartureDateTime="2024-06-16T09:00:00" FlightNumber="9P741" JourneyDuration="PT3H5M0.000S" RPH="9P$SHJ/ISB$9313$20240616090000$20240616130500" SmokingAllowed="false" returnFlag="false">
<ns1:DepartureAirport LocationCode="SHJ" Terminal="" />
<ns1:ArrivalAirport LocationCode="ISB" Terminal="" />
</ns1:FlightSegment>
</ns1:OriginDestinationOption>
</ns1:OriginDestinationOptions>
</ns1:OriginDestinationInformation>
<ns1:AAAirAvailRSExt>
<ns1:PricedItineraries>
<ns1:PricedItinerary SequenceNumber="1">
<ns1:AirItinerary>
<ns1:OriginDestinationOptions>
<ns1:OriginDestinationOption>
<ns1:FlightSegment ArrivalDateTime="2024-06-15T20:15:00" DepartureDateTime="2024-06-15T18:20:00" FlightNumber="9P674" RPH="9P$KHI/ISB$9949$20240615182000$20240615201500" returnFlag="false">
<ns1:DepartureAirport LocationCode="KHI" Terminal="" />
<ns1:ArrivalAirport LocationCode="ISB" Terminal="" />
</ns1:FlightSegment>
</ns1:OriginDestinationOption>
<ns1:AABundledServiceExt applicableOnd="KHI/ISB" applicableOndSequence="0">
<ns1:bundledService>
<ns1:bunldedServiceId>147</ns1:bunldedServiceId>
<ns1:bundledServiceName>Value</ns1:bundledServiceName>
<ns1:perPaxBundledFee>1800.00</ns1:perPaxBundledFee>
<ns1:bookingClasses>Y9</ns1:bookingClasses>
<ns1:description>10 Kg Carry-on Baggage
23 Kg Checked Baggage
Sandwich with Soft Drinks
Free Seat (row 8 onwards)
Free Modification (One Up to 24h)</ns1:description>
<ns1:includedServies>BAGGAGE</ns1:includedServies>
<ns1:includedServies>SEAT_MAP</ns1:includedServies>
<ns1:includedServies>MEAL</ns1:includedServies>
<ns1:includedServies>FLEXI_CHARGES</ns1:includedServies>
</ns1:bundledService>
<ns1:bundledService>
<ns1:bunldedServiceId>46</ns1:bunldedServiceId>
<ns1:bundledServiceName>Ultimate</ns1:bundledServiceName>
<ns1:perPaxBundledFee>2900.00</ns1:perPaxBundledFee>
<ns1:bookingClasses>Y9</ns1:bookingClasses>
<ns1:description>10 Kg Carry-on Baggage
46 Kg Checked Baggage
Premium Meal, Desert and Salad
Any Seat – Including Front Row
2 Free Modification (Up to 6h)
1 Free Cancellation (Up to 6h)
Priority Check-in
50% Cash Refund* (Up to 24h)</ns1:description>
<ns1:includedServies>BAGGAGE</ns1:includedServies>
<ns1:includedServies>SEAT_MAP</ns1:includedServies>
<ns1:includedServies>MEAL</ns1:includedServies>
<ns1:includedServies>AIRPORT_SERVICE</ns1:includedServies>
<ns1:includedServies>FLEXI_CHARGES</ns1:includedServies>
</ns1:bundledService>
</ns1:AABundledServiceExt>
</ns1:OriginDestinationOptions>
</ns1:AirItinerary>
<ns1:AirItineraryPricingInfo PricingSource="Published">
<ns1:ItinTotalFare NegotiatedFare="false">
<ns1:BaseFare Amount="25355.00" CurrencyCode="PKR" DecimalPlaces="2" />
<ns1:EquiBaseFare Amount="25355.00" CurrencyCode="PKR" DecimalPlaces="2" />
<ns1:TotalFare Amount="27780.73" CurrencyCode="PKR" DecimalPlaces="2" />
<ns1:TotalEquivFare Amount="27780.73" CurrencyCode="PKR" DecimalPlaces="2" />
<ns1:TotalFareWithCCFee Amount="27780.73" CurrencyCode="PKR" DecimalPlaces="2" />
<ns1:TotalEquivFareWithCCFee Amount="27780.73" CurrencyCode="PKR" DecimalPlaces="2" />
</ns1:ItinTotalFare>
<ns1:PTC_FareBreakdowns>
<ns1:PTC_FareBreakdown PricingSource="Published">
<ns1:PassengerTypeQuantity Age="0" Code="ADT" Quantity="1" />
<ns1:FareBasisCodes>
<ns1:FareBasisCode>P</ns1:FareBasisCode>
</ns1:FareBasisCodes>
<ns1:PassengerFare NegotiatedFare="false">
<ns1:BaseFare Amount="25355.00" CurrencyCode="PKR" DecimalPlaces="2" />
<ns1:EquiBaseFare Amount="25355.00" CurrencyCode="PKR" DecimalPlaces="2" />
<ns1:Taxes>
<ns1:Tax Amount="25.00" CurrencyCode="PKR" DecimalPlaces="2" TaxCode="N9DOM" TaxName="Pakistan DOM Stamp Duty (N9)" />
<ns1:Tax Amount="500.00" CurrencyCode="PKR" DecimalPlaces="2" TaxCode="SPDOM" TaxName="Pakistan DOM Embarkation Fee (SP)" />
<ns1:Tax Amount="100.00" CurrencyCode="PKR" DecimalPlaces="2" TaxCode="XZDOM" TaxName="Pakistan DOM Security Charge (XZ)" />
<ns1:Tax Amount="20.00" CurrencyCode="PKR" DecimalPlaces="2" TaxCode="YIDOM" TaxName="Pakistan DOM Government Airport Tax (YI)" />
<ns1:Tax Amount="1500.00" CurrencyCode="PKR" DecimalPlaces="2" TaxCode="PKDOM" TaxName="Pakistan DOM Excise Duty (PK)" />
</ns1:Taxes>
<ns1:Fees>
<ns1:Fee Amount="280.73" CurrencyCode="PKR" DecimalPlaces="2" FeeCode="9PWKDSUR/Weekend SUR 9P DOM" />
</ns1:Fees>
<ns1:TotalFare Amount="27780.73" CurrencyCode="PKR" DecimalPlaces="2" />
</ns1:PassengerFare>
<ns1:TravelerRefNumber RPH="A1" />
</ns1:PTC_FareBreakdown>
</ns1:PTC_FareBreakdowns>
</ns1:AirItineraryPricingInfo>
</ns1:PricedItinerary>
</ns1:PricedItineraries>
</ns1:AAAirAvailRSExt>
<ns1:Errors />
</ns1:OTA_AirAvailRS>
</soap:Body>
</soap:Envelope>
如果有人可以指导我做错了什么?
我最终通过使用下面的代码并通过修改在Parse SOAP XML feed in PHP
中获得线索来实现了这一点我注意到 SOAP 和 SOAP-ENV 不能在标签中
$result = str_replace("ns1:","",$result);
$result = str_replace(":ns1","",$result);
$result = str_ireplace(['SOAP-ENV:', 'SOAP:','soap:'], '', $result);
$parser = simplexml_load_string($result);
$responseFormat = $parser-
>children('http://www.opentravel.org/OTA/2003/05')->Body->children()->OTA_AirAvailRQ;
echo "<pre>";
var_dump($parser);
die();