Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Can't get my xpath working with selectsinglenode

$
0
0

Hi all,

I am having huge problems to get a simple xpath working on a xmldocument.

Here is the xml file i am trying to get the values from:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><SearchProductsResponse xmlns="http://api.zanox.com/namespace/2011-03-01/"><page>0</page><items>10</items><total>385</total><query>nike</query><productItems><productItem id="92c9644ce15d337077e35756167c7578"><name>Nike - Retro-Jersey-Shorts - Blau</name><modified>2015-08-27T03:04:49+02:00</modified><program id="7408">Asos.com DE</program><price>20.99</price><currency>EUR</currency><trackingLinks><trackingLink adspaceId="1009338"><ppv>http://ad.zanox.com/ppv/?22436292C14041752&amp;ULP=[[Nike/Nike-Jersey-Retro-Shorts/Prod/pgeproduct.aspx?iid=5019559&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=rlxmpwqit&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppv><ppc>http://ad.zanox.com/ppc/?22436292C14041752&amp;ULP=[[Nike/Nike-Jersey-Retro-Shorts/Prod/pgeproduct.aspx?iid=5019559&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=rlxmpwqit&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppc></trackingLink></trackingLinks><description>Nike - Retro-Jersey-Shorts - Blau - Farbe:Blau</description><descriptionLong>Shorts von Nike weiches Jersey Taillenbund mit Kordelzug schräge Seitentaschen Straight Fit - gerader Beinschnitt Maschinenwäsche 100% Baumwolle Model trägt Größe M und ist 178 cm/5 Fuß 10 Zoll groß</descriptionLong><manufacturer>Nike</manufacturer><deliveryTime>2 to 4 days</deliveryTime><category id="3180000">Shorts</category><image><large>http://images.asos-media.com/inv/media/9/5/5/9/5019559/blue/image1xxl.jpg</large></image><shippingCosts>3.0</shippingCosts><shipping>3.0</shipping><merchantCategory>Herren / Nike / Shorts</merchantCategory><merchantProductId>3475300</merchantProductId></productItem><productItem id="49b14a23c4422f9f60a26621923f1836"><name>Nike - Shorts, 10 Zoll - Schwarz</name><modified>2015-08-28T03:04:10+02:00</modified><program id="7408">Asos.com DE</program><price>28.99</price><currency>EUR</currency><trackingLinks><trackingLink adspaceId="1009338"><ppv>http://ad.zanox.com/ppv/?22436292C14041752&amp;ULP=[[Nike-Shorts-00-Zoll/169rgc/?iid=4864074&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=pitiiprqr&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppv><ppc>http://ad.zanox.com/ppc/?22436292C14041752&amp;ULP=[[Nike-Shorts-00-Zoll/169rgc/?iid=4864074&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=pitiiprqr&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppc></trackingLink></trackingLinks><description>Nike - Shorts, 10 Zoll - Schwarz - Farbe:Schwarz</description><descriptionLong>Shorts von Nike weiches gewebtes Material durchgehendes Netzfutter Elastischer Bund mit Kordel Logostickerei Loose Fit - fällt locker über den Körper Maschinenwäsche 100% Polyester Model trägt Größe M und ist 178 cm/5 Fuß 10 Zoll groß</descriptionLong><manufacturer>Nike</manufacturer><deliveryTime>2 to 4 days</deliveryTime><category id="3180000">Shorts</category><image><large>http://images.asos-media.com/inv/media/4/7/0/4/4864074/black/image1xxl.jpg</large></image><shippingCosts>3.0</shippingCosts><shipping>3.0</shipping><merchantCategory>Herren / Nike / Shorts</merchantCategory><merchantProductId>3343248</merchantProductId></productItem><productItem id="05e7117ada8960185edda22195219490"><name>Nike - AW77 - Jogginghose mit Bündchen - Kalkgrau</name><modified>2015-08-30T03:04:29+02:00</modified><program id="7408">Asos.com DE</program><price>48.99</price><currency>EUR</currency><trackingLinks><trackingLink adspaceId="1009338"><ppv>http://ad.zanox.com/ppv/?22436292C14041752&amp;ULP=[[Nike/Nike-AW77-Cuffed-Joggers/Prod/pgeproduct.aspx?iid=5017389&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=lirplimta&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppv><ppc>http://ad.zanox.com/ppc/?22436292C14041752&amp;ULP=[[Nike/Nike-AW77-Cuffed-Joggers/Prod/pgeproduct.aspx?iid=5017389&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=lirplimta&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppc></trackingLink></trackingLinks><description>Nike - AW77 - Jogginghose mit Bündchen - Kalkgrau - Farbe:Kalkgrau</description><descriptionLong>Jogginghosen von Nike Sweatshirt-Stoff Taillenbund mit Kordelzug drei Taschen Rippenbündchen schmale Passform, sitzt eng am Körper Maschinenwäsche 100% Baumwolle Model trägt Größe M und ist 178 cm/5 Fuß 10 Zoll groß</descriptionLong><manufacturer>Nike</manufacturer><deliveryTime>2 to 4 days</deliveryTime><category id="3170000">Shirts &amp; Tops</category><image><large>http://images.asos-media.com/inv/media/9/8/3/7/5017389/greymarl/image1xxl.jpg</large></image><shippingCosts>3.0</shippingCosts><shipping>3.0</shipping><merchantCategory>Herren / Nike / T-Shirts</merchantCategory><merchantProductId>3473419</merchantProductId></productItem><productItem id="f98159a9f7b271a6ea8695460a316093"><name>Nike - Windrunner - Jacke 544119-088</name><modified>2015-08-26T03:04:30+02:00</modified><program id="7408">Asos.com DE</program><price>52.49</price><currency>EUR</currency><trackingLinks><trackingLink adspaceId="1009338"><ppv>http://ad.zanox.com/ppv/?22436292C14041752&amp;ULP=[[Nike-Windjacke/17f3je/?iid=5018248&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=rqqaqqqpq&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppv><ppc>http://ad.zanox.com/ppc/?22436292C14041752&amp;ULP=[[Nike-Windjacke/17f3je/?iid=5018248&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=rqqaqqqpq&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppc></trackingLink></trackingLinks><description>Nike - Windrunner - Jacke 544119-088 - Farbe:</description><descriptionLong>Nike - Windrunner - Jacke 544119-088</descriptionLong><manufacturer>Nike</manufacturer><deliveryTime>2 to 4 days</deliveryTime><category id="3000000">Fashion &amp; Accessories</category><image><large>http://images.asos-media.com/inv/media/8/4/2/8/5018248/grey/image1xxl.jpg</large></image><shippingCosts>3.0</shippingCosts><shipping>3.0</shipping><merchantCategory>Bekleidung &amp; Accessoires</merchantCategory><merchantProductId>3474195</merchantProductId></productItem><productItem id="6c68dc7d6f90083424794c4d5e19bc10"><name>Nike - HW77 - Sweatshirt</name><modified>2015-08-26T03:04:30+02:00</modified><program id="7408">Asos.com DE</program><price>44.99</price><currency>EUR</currency><trackingLinks><trackingLink adspaceId="1009338"><ppv>http://ad.zanox.com/ppv/?22436292C14041752&amp;ULP=[[Nike/Nike-AW77-Sweatshirt/Prod/pgeproduct.aspx?iid=4872363&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=plamplriw&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppv><ppc>http://ad.zanox.com/ppc/?22436292C14041752&amp;ULP=[[Nike/Nike-AW77-Sweatshirt/Prod/pgeproduct.aspx?iid=4872363&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=plamplriw&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppc></trackingLink></trackingLinks><description>Nike - HW77 - Sweatshirt - Farbe:</description><descriptionLong>Nike - HW77 - Sweatshirt</descriptionLong><manufacturer>Nike</manufacturer><deliveryTime>2 to 4 days</deliveryTime><category id="3150000">Pullovers</category><image><large>http://images.asos-media.com/inv/media/3/6/3/2/4872363/grey/image1xxl.jpg</large></image><shippingCosts>3.0</shippingCosts><shipping>3.0</shipping><merchantCategory>Bekleidung &amp; Accessoires</merchantCategory><merchantProductId>3350172</merchantProductId></productItem><productItem id="0520b12655033a3e093f594da4cdf6a0"><name>Nike - Pro Fierce - Sport-BH</name><modified>2015-08-23T03:04:59+02:00</modified><program id="7408">Asos.com DE</program><price>25.99</price><currency>EUR</currency><trackingLinks><trackingLink adspaceId="1009338"><ppv>http://ad.zanox.com/ppv/?22436292C14041752&amp;ULP=[[Nike-Pro-Fierce-Sport-BH/16q6pc/?iid=4697141&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=rxamprmqm&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppv><ppc>http://ad.zanox.com/ppc/?22436292C14041752&amp;ULP=[[Nike-Pro-Fierce-Sport-BH/16q6pc/?iid=4697141&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=rxamprmqm&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppc></trackingLink></trackingLinks><description>Nike - Pro Fierce - Sport-BH - Farbe:</description><descriptionLong>Sport-BH von Nike seidiges, elastisches Material U-Ausschnitt weiche Körbchen Unterbrustband für zusätzichen Halt kontrastierendes Stretch-Unterband Racerback-Träger aus Netz Maschinenwäsche 88% Polyester, 12% Elastan</descriptionLong><manufacturer>Nike</manufacturer><deliveryTime>2 to 4 days</deliveryTime><category id="3000000">Fashion &amp; Accessories</category><image><large>http://images.asos-media.com/inv/media/1/4/1/7/4697141/bluelagoonvolt/image1xxl.jpg</large></image><shippingCosts>3.0</shippingCosts><shipping>3.0</shipping><merchantCategory>Bekleidung &amp; Accessoires</merchantCategory><merchantProductId>3201140</merchantProductId></productItem><productItem id="2dde5022488f19d30cfb86dacc267627"><name>Nike - Solarsoft - Flip-Flops - Schwarz</name><modified>2015-07-31T03:01:00+02:00</modified><program id="7408">Asos.com DE</program><price>16.99</price><currency>EUR</currency><trackingLinks><trackingLink adspaceId="1009338"><ppv>http://ad.zanox.com/ppv/?22436292C14041752&amp;ULP=[[Nike-Solarsoft-Flip-Flops/16cjh5/?iid=4757251&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=rxampratr&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppv><ppc>http://ad.zanox.com/ppc/?22436292C14041752&amp;ULP=[[Nike-Solarsoft-Flip-Flops/16cjh5/?iid=4757251&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=rxampratr&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppc></trackingLink></trackingLinks><description>Nike - Solarsoft - Flip-Flops - Schwarz - Farbe:Schwarz</description><descriptionLong>Flip-Flops von Nike Logo-Applikation zum Überziehen Zehensteg flache Profilsohle Mit einem sauberen, feuchten Schwamm reinigen Obermaterial: 100% sonstige Materialien</descriptionLong><manufacturer>Nike</manufacturer><deliveryTime>2 to 4 days</deliveryTime><category id="3250000">Shoes</category><image><large>http://images.asos-media.com/inv/media/1/5/2/7/4757251/black/image1xxl.jpg</large></image><shippingCosts>3.0</shippingCosts><shipping>3.0</shipping><merchantCategory>Bekleidung &amp; Accessoires</merchantCategory><merchantProductId>3252419</merchantProductId></productItem><productItem id="cd7d35a9deb04eef8f31c438703856de"><name>Nike - Pilotensonnenbrille - Schwarz</name><modified>2015-08-26T03:04:30+02:00</modified><program id="7408">Asos.com DE</program><price>88.99</price><currency>EUR</currency><trackingLinks><trackingLink adspaceId="1009338"><ppv>http://ad.zanox.com/ppv/?22436292C14041752&amp;ULP=[[Nike-Pilotensonnenbrille/16y9rp/?iid=4947727&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=rppawtwtw&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppv><ppc>http://ad.zanox.com/ppc/?22436292C14041752&amp;ULP=[[Nike-Pilotensonnenbrille/16y9rp/?iid=4947727&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=rppawtwtw&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppc></trackingLink></trackingLinks><description>Nike - Pilotensonnenbrille - Schwarz - Farbe:Schwarz</description><descriptionLong>Sonnenbrille von Nike leichter Pilotenrahmen doppelter Nasensteg geformte Nasenpolster für zusätzlichen Komfort abgestuft getönte Gläser logoverzierte Bügel mit abgerundeten Enden für sicheren Halt voller UV-Schutz Gläsergröße: 61mm</descriptionLong><manufacturer>Nike</manufacturer><deliveryTime>2 to 4 days</deliveryTime><category id="0" /><image><large>http://images.asos-media.com/inv/media/7/2/7/7/4947727/black/image1xxl.jpg</large></image><shippingCosts>3.0</shippingCosts><shipping>3.0</shipping><merchantCategory>Herren / Sale / Accessoires / Pilotenbrille</merchantCategory><merchantProductId>3414148</merchantProductId></productItem><productItem id="4bfbb0cfeab1bea32103174e3168409c"><name>Nike - Jordan - Shorts - Schwarz</name><modified>2015-08-26T03:04:30+02:00</modified><program id="7408">Asos.com DE</program><price>44.99</price><currency>EUR</currency><trackingLinks><trackingLink adspaceId="1009338"><ppv>http://ad.zanox.com/ppv/?22436292C14041752&amp;ULP=[[Nike-Jordan-Shorts/184k9f/?iid=5452666&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=lqxtwqmwx&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppv><ppc>http://ad.zanox.com/ppc/?22436292C14041752&amp;ULP=[[Nike-Jordan-Shorts/184k9f/?iid=5452666&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=lqxtwqmwx&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppc></trackingLink></trackingLinks><description>Nike - Jordan - Shorts - Schwarz - Farbe:Schwarz</description><descriptionLong>Shorts von Jordan atmungsaktiver Netzstoff elastischer Bund Aufdruck vorne Seitentaschen Loose Fit - fällt locker über den Körper Maschinenwäsche 100% Polyester Unser Model trägt Größe M und ist 185,5 cm/6 Fuß, 1 Zoll groß</descriptionLong><manufacturer>Jordan</manufacturer><deliveryTime>2 to 4 days</deliveryTime><category id="3180000">Shorts</category><image><large>http://images.asos-media.com/inv/media/6/6/6/2/5452666/black/image1xxl.jpg</large></image><shippingCosts>3.0</shippingCosts><shipping>3.0</shipping><merchantCategory>Herren / Shorts / Jersey</merchantCategory><merchantProductId>3852709</merchantProductId></productItem><productItem id="b4a8b6fb02ccdc53405ca420dd527241"><name>Nike Air - Safari - Turnschuhe - Schwarz</name><modified>2015-08-26T03:04:30+02:00</modified><program id="7408">Asos.com DE</program><price>76.99</price><currency>EUR</currency><trackingLinks><trackingLink adspaceId="1009338"><ppv>http://ad.zanox.com/ppv/?22436292C14041752&amp;ULP=[[Nike-Air-Safari-Turnschuhe/16b7vu/?iid=4759797&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=plampliqp&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppv><ppc>http://ad.zanox.com/ppc/?22436292C14041752&amp;ULP=[[Nike-Air-Safari-Turnschuhe/16b7vu/?iid=4759797&amp;istCompanyId=030f1ff6-3a15-4425-bccd-ba2bdee3fa38&amp;istItemId=plampliqp&amp;istBid=t&amp;channelref=affiliate]]&amp;zpar9=[[43EEF0445509C7205827]]</ppc></trackingLink></trackingLinks><description>Nike Air - Safari - Turnschuhe - Schwarz - Farbe:Schwarz</description><descriptionLong>Turnschuhe von Nike Obermaterial aus Leder und Netzstoff Schnürverschluss geformter, gepolsterter Schaft mit Logo an der Seite dicke, stützende, strapazierfähige Sohle strukturierte, griffige Sohle mit geeignetem Pflegemittel behandeln 50% Echtleder, 50% Stoff</descriptionLong><manufacturer>Nike</manufacturer><deliveryTime>2 to 4 days</deliveryTime><category id="3000000">Fashion &amp; Accessories</category><image><large>http://images.asos-media.com/inv/media/7/9/7/9/4759797/black/image1xxl.jpg</large></image><shippingCosts>3.0</shippingCosts><shipping>3.0</shipping><merchantCategory>Bekleidung &amp; Accessoires</merchantCategory><merchantProductId>3254596</merchantProductId></productItem></productItems></SearchProductsResponse>

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(MapPath("~/App_Data/zanox.xml"));
string name = xmlDoc.SelectSingleNode(@"/SearchProductsResponse/productItems/productItem[1]/name").InnerText;
The above code is what i am using to try to get the value from the name field :

Has anyone a idea on what i am doing wrong?



Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>