I am trying to extract the image url from a rss feed ...but the image url is wrapped in the <enclosure url> tag.......so my question is ..how would I extract the value from the enclosure tag?
here is the feed data.....
<rss version="2.0">
<channel>
<title>Beverly Hills Car Club RSS 2.0 Feed</title>
<link>http://www.beverlyhillscarclub.com/</link>
<description>Beverly Hills Car Club RSS 2.0 Feed</description>
<language>en-us</language>
<item>
<title>1969 Alfa Romeo Duetto</title>
<description>
<=!=[=C=D=A=T=A=[
1969 Alfa Romeo Duetto <br /> Stock # 03077, Mileage: 0, VIN # <br /> Price: $17,500<br /> Exterior Color: Silver, Interior Color: <br /> <div style="text-align: center;"><span style="color: rgb(255, 0, 0);"><span style="font-size: xx-large;"><em><strong> <span style="font-family: A
]=]=>
<=!=[=C=D=A=T=A=[
rial, Helvetica, sans-serif;">1969 Alfa Romeo Duetto with 2 Tops</span></strong></em></span></span></div><br style="font-family: Arial, Helvetica, sans-serif;" /><span style="font-size: large;"><span style="font-family: Arial, Helvetica, sans-serif;">1969 Alfa Romeo Duetto, 2 tops, silver with red interior, beautiful color combination, covered headlights, very clean and detailed engine bay, solid undercarriage, nice weekend driver that is mechanically sound. For $17,500</span><br style="font-family: Arial, Helvetica, sans-serif;" /><br style="font-family: Arial, Helvetica, sans-serif;" /><span style="font-family: Arial, Helvetica, sans-serif;">If you have any additional questions <strong><span style="color: rgb(0, 255, 0);">Please call 310-975-0272</span></strong> or email with any questions! We also welcome all international buyers. We can help with shipping quotes and arrangements.</span></span>
]=]=>
</description>
<link>
1969 Alfa Romeo Duetto
</link>
<enclosure url="http://www.beverlyhillscarclub.com/galleria_images/2078/2078_main_t.jpg" length="2791" type="image/jpeg"/> <----------------- this is what I need ------------------>
<guid>
1969 Alfa Romeo Duetto
</guid>
<pubDate>Wed, 16 Oct 2013 03:25:21 CDT</pubDate>
</item>
I tried this code
but the value of ImageUrl is always null.....
thank you for your help
-InkedGFX
here is the feed data.....
<rss version="2.0">
<channel>
<title>Beverly Hills Car Club RSS 2.0 Feed</title>
<link>http://www.beverlyhillscarclub.com/</link>
<description>Beverly Hills Car Club RSS 2.0 Feed</description>
<language>en-us</language>
<item>
<title>1969 Alfa Romeo Duetto</title>
<description>
<=!=[=C=D=A=T=A=[
1969 Alfa Romeo Duetto <br /> Stock # 03077, Mileage: 0, VIN # <br /> Price: $17,500<br /> Exterior Color: Silver, Interior Color: <br /> <div style="text-align: center;"><span style="color: rgb(255, 0, 0);"><span style="font-size: xx-large;"><em><strong> <span style="font-family: A
]=]=>
<=!=[=C=D=A=T=A=[
rial, Helvetica, sans-serif;">1969 Alfa Romeo Duetto with 2 Tops</span></strong></em></span></span></div><br style="font-family: Arial, Helvetica, sans-serif;" /><span style="font-size: large;"><span style="font-family: Arial, Helvetica, sans-serif;">1969 Alfa Romeo Duetto, 2 tops, silver with red interior, beautiful color combination, covered headlights, very clean and detailed engine bay, solid undercarriage, nice weekend driver that is mechanically sound. For $17,500</span><br style="font-family: Arial, Helvetica, sans-serif;" /><br style="font-family: Arial, Helvetica, sans-serif;" /><span style="font-family: Arial, Helvetica, sans-serif;">If you have any additional questions <strong><span style="color: rgb(0, 255, 0);">Please call 310-975-0272</span></strong> or email with any questions! We also welcome all international buyers. We can help with shipping quotes and arrangements.</span></span>
]=]=>
</description>
<link>
1969 Alfa Romeo Duetto
</link>
<enclosure url="http://www.beverlyhillscarclub.com/galleria_images/2078/2078_main_t.jpg" length="2791" type="image/jpeg"/> <----------------- this is what I need ------------------>
<guid>
1969 Alfa Romeo Duetto
</guid>
<pubDate>Wed, 16 Oct 2013 03:25:21 CDT</pubDate>
</item>
I tried this code
foreach (XmlNode node in nodes) { if (node != null) { dm.ItemTitle = node["title"].InnerText; dm.Links = node["link"].InnerText; dm.Description = node["description"].InnerText; dm.ImageUrl = node.Attributes["enclosure url"].Value; string description = dm.Description; string[] seperator = { " ", "src=" }; string Value = description; string[] imagelink = Value.Split(seperator, StringSplitOptions.None); string imagelink_final = imagelink[2].Replace('"', ' ').Trim(); ImageLink.Add(imagelink[2].Replace('"', ' ').Trim()); ListViewItem lvi = new ListViewItem(dm.ItemTitle); lvi.SubItems.Add(dm.Description); lvi.SubItems.Add(dm.Links); lvi.SubItems.Add(" "); lvi.SubItems.Add(dm.ImageUrl); listView1.Items.Add(lvi);
but the value of ImageUrl is always null.....
thank you for your help
-InkedGFX