I managed to retrieve the top elements in an xml file (see link in the code) and it works but I want to retrieve elements deeper in the xml file and more particularly these 2 elements: price, productUrl but these are under offers/offer namespace, but in the code below I only managed to retrieve the elements under products/product namespace. Can anyone please help with the code below so I can retrieve the 2 elements: price, productUrl ? Thanks
indent preformatted text by 4 spaces
Dim doc As New XmlDocument()
doc.Load("http://api.tradedoubler.com/1.0/products.xml?token=_token_")
Dim nsManager As New XmlNamespaceManager(doc.NameTable)
nsManager.AddNamespace("ns1", "urn:com:tradedoubler:pf:model:xml:output")
nsManager.AddNamespace("ns2", "urn:com:tradedoubler:pf:model:xml:common")
Dim nodes As XmlNodeList = doc.SelectNodes("//ns1:products/ns1:product", nsManager)
Dim dataSource As IEnumerable
dataSource = From node As XmlNode in nodes
Select Name = node.SelectSingleNode("ns2:name", nsManager).InnerText, _
Description = node.SelectSingleNode("ns2:description", nsManager).InnerText, _
Image = node.SelectSingleNode("ns2:productImage", nsManager).InnerText
rpMyRepeater.DataSource = dataSource
rpMyRepeater.DataBind()
@hm9, FYI, I formatted your post and removed the token so it doesn’t get spread around. Next time please be more careful of what you copy and paste onto the Internet.
Also, when I get back to work tomorrow, I’m going to open this open again to see if I can give you any tips. I’d try it right now, but its been a long day and having Visual Studio in front of me tomorrow will surely help me lead you in the right direction.