2016-05-06 4 views
0

xmlnodelistのを得る方法正確に2つのOriginDestinationOptionを持っています。正確に2つのOriginDestinationOptionを持つOriginDestinationOptionsのxmlnodelistを得る方法

//ns1:OriginDestinationOptions[count(ns1:OriginDestinationOption)=2] 

の目的で使用する方(XmlNamespaceManagerにプレフィックスns1を登録することを確認しますとSelectNodes()またはSelectSingleNode()に名前空間マネージャに合格することを忘れないでください:XPathは以下のようになり

<?xml version="1.0" encoding="utf-8"?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <soapenv:Body> 
     <OTA_AirPriceRS xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:ns1="http://www.opentravel.org/OTA/2003/05"> 
      <ns1:PricedItinerary ApplyMarkup="Y" FareType="Refundable" LFSPRICEDIFF="0" MatrixFare="" OriginDestinationRPH="DELBOMG8346G820160520BOMDELG8329G820160522" OriginDestinationRefNumber="2" ReturnOnly="true" SequenceNumber="" SupplierSystem="G8CP" isTBF="false"> 
       <ns1:AirItinerary FareType="Refundable" SupplierCode="G8CP" SupplierSystem="G8CP" TripType="" UniqueIdentifier="1"> 
        <ns1:OriginDestinationOptions WorkFlow="PFB"> 
         <ns1:OriginDestinationOption> 
         </ns1:OriginDestinationOption> 
        <ns1:OriginDestinationOption> 
       </ns1:OriginDestinationOption> 
      </ns1:AirItinerary> 
     </OTA_AirPriceRS> 
    </soapenv:Body> 
</soapenv:Envelope> 
+0

2つの子ノード「xyz」を持つすべての「abc」ノードを選択したいとします。子ノードの発生は2以下であり、2以上である。 – user1799669

答えて

0

XPathを実行します)。

+0

貴重なご意見ありがとうございます。解決された問題:-) – user1799669

関連する問題