Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 9th, 2012  |  syntax: None  |  size: 1.26 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Windows phone 7 xml linq queries trouble
  2. <itemListCollection xmlns="urn:webjet.com.au" xmlns:i="http://www.w3.org/2001/XMLSchema-?Instance">
  3. <itemList>
  4.     <listCode>FlightSearchAirportsTT</listCode>
  5.     <items>
  6.         <item>
  7.             <code>ADL</code>
  8.             <value>Adelaide</value>
  9.         </item>
  10.         <item>
  11.             <code>BNE</code>
  12.             <value>Brisbane</value>
  13.         </item>
  14.          ....
  15.          ....
  16.     </items>
  17. </itemList>
  18. <itemList>
  19.     <listCode>AIRPORTCODES_LATLONS</listCode>
  20.     <items>
  21.         <item>
  22.             <code>EBB</code>
  23.             <value>0.060277777777778;32.4</value>
  24.         </item>
  25.         <item>
  26.             <code>NYK</code>
  27.             <value>0.066666666666667;37.03333333333</value>
  28.         </item>
  29.                     ........
  30.                     .......
  31.   <item>
  32.             <code>KAB</code>
  33.             <value>ZW</value>
  34.         </item>
  35.         <item>
  36.             <code>VFA</code>
  37.             <value>ZW</value>
  38.         </item>
  39.     </items>
  40. </itemList>
  41.        
  42. // if your xml is in a file:
  43.         XDocument doc = XDocument.Load("/path/of/xml");
  44.  
  45.         // if your xml is in a string field:
  46.         XDocument doc = XDocument.Parse(stringField);
  47.         XElement firstList = doc.Descendants().Where(x => x.Name == "itemList").First();