I'm using this script, kindly posted on this forum that lists items from an rss. My issue is I have a <img> that is contanined within the <description> that I wish to remove and position above the <title>. The way it renders is:
<title></title>
<description><img> body copy </description>
What I need is:
<img>
<title></title>
<description></description>
Any idea how I would do this. The script I am using is:
@using System.Xml;
@{
//Get the XML from remote URL
XmlDocument xml = new XmlDocument();
//URL currently hardcoded - but you could use a macro param to pass in URL
Extracting image from RSS text
Hi,
I'm using this script, kindly posted on this forum that lists items from an rss. My issue is I have a <img> that is contanined within the <description> that I wish to remove and position above the <title>. The way it renders is:
<title></title>
<description><img> body copy </description>
What I need is:
<img>
<title></title>
<description></description>
Any idea how I would do this. The script I am using is:
@using System.Xml;
@{
//Get the XML from remote URL
XmlDocument xml = new XmlDocument();
//URL currently hardcoded - but you could use a macro param to pass in URL
xml.Load("http://ebiquityopinion.com/?feed=rss2");
//Select the nodes we want to loop through
XmlNodeList nodes = xml.SelectNodes("//item");
//Traverse the entire XML nodes.
foreach (XmlNode node in nodes)
{
//Get the value from the <title> node
var title = node.SelectSingleNode("title").InnerText;
//Get the value from the <description> node
var description = node.SelectSingleNode("description").InnerText;
<li>
<h3><strong>@title</strong></h3>
@Html.Raw(description)
</li>
}
}
</ul>
is working on a reply...