Click here to Skip to main content
15,441,629 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am trying to extract a single node from xml in vb.net code based on the value of one the child node's attribute .I am getting Error as:

Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.



My vb.net code is like this:

Dim str As String
      str = Session("Result").ToString()
      Dim doc As New XmlDocument()

      doc.LoadXml(str)



      Dim cookingNode As XmlNode = doc.SelectSingleNode("//ns1:AirItinerary            /ns1:OriginDestinationOptions/ns1:OriginDestinationOption/ns1:FormData/ns1:FBC[@FlightNumber='" & Request.QueryString("fid") & "']")

      Console.WriteLine(cookingNode.OuterXml)




my xml file is like this

XML
<?xml-stylesheet type="text/xsl" href="XSLTFile.xsl"?>
 <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>
       <ns1:OTA_AirLowFareSearchRS Version="2.001" xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:ns1="http://www.opentravel.org/OTA/2003/05">
           <ns1:Success />
           <ns1:PricedItineraries>
             <ns1:PricedItinerary CompositeFlightNumber="AI" CountCompositeFlightNumber="1" FareType="Non-Refundable" InboundSegmentReference="1" MatrixFare="true" Mode="" OriginDestinationRPH="BLRHYDAI517AI20130321" OutboundSegmentReference="1" Priority="1" RecommendationRPH="1" Refundable="true" ReturnOnly="false" SequenceNumber="1.0" SupplierCode="1AWS">
               <ns1:AirItinerary SupplierSystem="Amadeus">
                 <ns1:OriginDestinationOptions>
                   <ns1:OriginDestinationOption Duration="01:05:00" FlightID="BLRHYDAI517AI2013-03-21" MajorityCarrier="AI" ReturnOnly="false" SupplierCode="1AWS" SupplierSystem="Amadeus" UniqueIdentifier="1.0">
                     <ns1:FlightSegment ArrivalDateTime="2013-03-21T09:20:00" CabinCode="Y" DeliveryMethod="Courier" DepartureDateTime="2013-03-21T08:15:00" Duration="01:05:00" FlightNumber="517" LTD="1AWS" LineNumber="Y" NumberInParty="BLRHYD" RPH="1" ResBookDesigCode="E" TicketType="Physical" ValidConnectionInd="1AWS">
                       <ns1:DepartureAirport AirPortName="Bengaluru" CityName="Bangalore" LocationCode="BLR" />
                       <ns1:ArrivalAirport AirPortName="Shamshabad Rajiv Gandhi" CityName="Hyderabad" LocationCode="HYD" />
                       <ns1:OperatingAirline Code="AI" />
                       <ns1:BookingClassAvail FareType="RP" ResBookDesigCode="E" ResBookDesigQuantity="5" Status="5" WebFareName="EAP30" />
                       <ns1:Equipment AirEquipType="319" />
                       <ns1:MarketingAirline Code="AI" MatrixCode="AI" Name="Air India" YTAirlineCode="AI" />
                       <ns1:ValidatingCarrier Code="AI" />
                     </ns1:FlightSegment>
                     <ns1:FormData>
                       <ns1:FBC Destination="HYD" FlightNumber="517" LineNumber="Y" Origin="BLR" SeatToSell="5" WebFareName="EAP30" />
                       <ns1:FareDifference>
                         <ns1:TotalFare ADT="1" BaseFare="670-ADT 670" CHD="0" Cabin="Economy" HostName="railserver" INF="0" Rbd="RP - E -" Tax="TTL-2355">3032</ns1:TotalFare>
                       </ns1:FareDifference>
                       <ns1:TicketingInfo DeliveryMethod="Courier" TicketTimeLimit="2013-03-03 18:43:00" TicketType="Physical" />
                       <ns1:AgentMarkup>
                         <ns1:Airlines>
                           <ns1:Airline>
                             <ns1:Code>6E</ns1:Code>
                             <ns1:GDS>0</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>C</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>0.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>2700.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Airline>
                             <ns1:Code>9H</ns1:Code>
                             <ns1:GDS>0</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>M</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>6.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>0.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Airline>
                             <ns1:Code>9W</ns1:Code>
                             <ns1:GDS>1</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>C</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>0.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>1100.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Airline>
                             <ns1:Code>AI</ns1:Code>
                             <ns1:GDS>1</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>C</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>0.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>1100.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Airline>
                             <ns1:Code>DN</ns1:Code>
                             <ns1:GDS>0</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>M</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>6.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>3250.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Airline>
                             <ns1:Code>G8</ns1:Code>
                             <ns1:GDS>0</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>C</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>0.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>2700.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Airline>
                             <ns1:Code>I7</ns1:Code>
                             <ns1:GDS>0</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>M</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>6.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>0.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Airline>
                             <ns1:Code>IC</ns1:Code>
                             <ns1:GDS>1</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>C</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>0.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>1100.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Airline>
                             <ns1:Code>IT</ns1:Code>
                             <ns1:GDS>1</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>C</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>0.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>1100.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Airline>
                             <ns1:Code>S2</ns1:Code>
                             <ns1:GDS>1</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>C</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>0.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>1100.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Airline>
                             <ns1:Code>SG</ns1:Code>
                             <ns1:GDS>0</ns1:GDS>
                             <ns1:WholeSalerFees>0.0000</ns1:WholeSalerFees>
                             <ns1:WholeSalerFeesType>F</ns1:WholeSalerFeesType>
                             <ns1:CommissionType>C</ns1:CommissionType>
                             <ns1:ApplyOn>BF</ns1:ApplyOn>
                             <ns1:Amount>0.0000</ns1:Amount>
                             <ns1:Type>P</ns1:Type>
                             <ns1:DiscountPLB>0.0000</ns1:DiscountPLB>
                             <ns1:DiscountPLBType>F</ns1:DiscountPLBType>
                             <ns1:DiscountPLBOn />
                             <ns1:Surcharge>2000.0000</ns1:Surcharge>
                           </ns1:Airline>
                           <ns1:Others>
                             <ns1:Code />
                             <ns1:GDS>1</ns1:GDS>
                             <ns1:WholeSalerFees>0</ns1:WholeSalerFees>
                             <ns1:CommissionType>C</ns1:CommissionType>
                             <ns1:ApplyOn>B</ns1:ApplyOn>
                             <ns1:Amount>0.0000</ns1:Amount>
                           </ns1:Others>
                         </ns1:Airlines>
                       </ns1:AgentMarkup>
                     </ns1:FormData>
                     <ns1:FormData />
                   </ns1:OriginDestinationOption>
                 </ns1:OriginDestinationOptions>
               </ns1:AirItinerary>
               <ns1:AirItineraryPricingInfo UniqueIdentifier="1.0">
                 <ns1:ItinTotalFare NegotiatedFare="No">
                   <ns1:BaseFare Amount="670" CurrencyCode="INR" />
                   <ns1:Taxes>
                     <ns1:Tax Amount="2355" CurrencyCode="INR" TaxCode="TTL" />
                   </ns1:Taxes>
                   <ns1:TotalFare Amount="3032" CurrencyCode="INR" />
                   <ns1:Fees>
                     <ns1:Fee Amount="0" />
                     <ns1:Fee Amount="0" FeeCode="YatraLCCSurcharge" />
                   </ns1:Fees>
                   <ns1:ServiceTax Amount="7" Currency="INR" Description="Service Tax" ServiceTaxCode="ST" ServiceTaxRate="0.01" />
                   <ns1:Markups>
                     <ns1:Markup Amount="0" CurrencyCode="INR" Description="0.0 wholesalerfees for client 1152" MarkupCode="DisplayMarkup" MarkupType="W" Type="C" />
                     <ns1:Markup Amount="0" CurrencyCode="INR" Description="0.0% on base fare for client - 1152" MarkupCode="DisplayMarkup" MarkupType="M" Type="C" />
                     <ns1:Markup Amount="0" CurrencyCode="INR" Description="0.0% on fuel surcharge 0 -for client - 1152" MarkupCode="DisplayMarkup" MarkupType="M" Type="C" />
                     <ns1:Markup Amount="0" CurrencyCode="INR" Description="0.0 on base fare for client - 1152" MarkupCode="DisplayMarkup" MarkupType="M" Type="P" />
                   </ns1:Markups>
                 </ns1:ItinTotalFare>
                 <ns1:PTC_FareBreakdowns>
                   <ns1:PTC_FareBreakdown>
                     <ns1:PassengerTypeQuantity Code="ADT" Quantity="1.0" />
                     <ns1:FareBasisCodes>
                       <ns1:FareBasisCode FareType="" SegmentRPH="">EAP30</ns1:FareBasisCode>
                     </ns1:FareBasisCodes>
                     <ns1:PassengerFare>
                       <ns1:BaseFare Amount="670" CurrencyCode="INR" />
                       <ns1:Taxes>
                         <ns1:Tax Amount="2355" CurrencyCode="INR" TaxCode="TTL" />
                       </ns1:Taxes>
                       <ns1:TotalFare Amount="3032" CurrencyCode="INR" />
                       <ns1:ServiceTax Amount="7" Currency="INR" Description="Service Tax" ServiceTaxCode="ST" ServiceTaxRate="0.01" />
                       <ns1:Markups>
                         <ns1:Markup Amount="0.0000" CurrencyCode="INR" Description="0.0 wholesalerfees for client 1152" MarkupCode="DisplayMarkup" MarkupType="W" Type="C" />
                         <ns1:Markup Amount="0" CurrencyCode="INR" Description="0.0 % on base fare for client - 1152" MarkupCode="DisplayMarkup" MarkupType="M" Type="C" />
                         <ns1:Markup Amount="0" Description="0.0% on fule surcharge 0.0for client1152" MarkupCode="DisplayMarkup" MarkupType="M" Type="C" />
                         <ns1:Markup Amount="0" CurrencyCode="INR" Description="0.0 on base fare for client1152" MarkupCode="DisplayMarkup" MarkupType="M" Type="P" />
                       </ns1:Markups>
                     </ns1:PassengerFare>
                   </ns1:PTC_FareBreakdown>
                 </ns1:PTC_FareBreakdowns>
                 <ns1:FareInfos>
                   <ns1:FareInfo>
                     <ns1:FareReference>EAP30</ns1:FareReference>
                     <ns1:FilingAirline Code="ZZ" />
                     <ns1:DepartureAirport LocationCode="BLR" />
                     <ns1:ArrivalAirport LocationCode="HYD" />
                   </ns1:FareInfo>
                 </ns1:FareInfos>
               </ns1:AirItineraryPricingInfo>
               <ns1:TicketingInfo DeliveryMethod="Courier" TicketTimeLimit="2013-03-03 18:43:00" TicketType="Physical" />
               <ns1:Notes>PENALTY APPLIES</ns1:Notes>
               <ns1:Notes>LAST TKT DTE21OCT12 - SEE ADV PURCHASE</ns1:Notes>
             </ns1:PricedItinerary>
                    :
                    :
                    :
 </ns1:PricedItineraries >
         </ns1:OTA_AirLowFareSearchRS >
                           </soapenv:Body >
</soapenv:Envelope >
Posted
Updated 4-Mar-13 11:13am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900