Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Display HTML in XML file as HTML

shinsnakeshinsnake Posts: 93Member
Usually what I've done, I've retrieved XML and assigned each element to a label or a drop down list, etc... Now, I'm looking at a Google News RSS search and I want to display the description item which is pure HTML code. I put it in a label to begin with, just to make sure I was getting what I wanted, but now I want to see the formatted HTML like a web page would return. Here's my example:

[code]



...

XmlNodeList xnodlResults = xdocQueryResults.SelectNodes("/rss/channel/item/description");

int nxelResults = 0;
foreach (XmlElement xelResults in xnodlResults)
{
switch (nxelResults)
{
case 0:
lblResults1.Text = xelResults.InnerXml.ToString();
nxelResults += 1;
break;
case 1:
lblResults2.Text = xelResults.InnerXml.ToString();
nxelResults += 1;
break;
case 2:
lblResults3.Text = xelResults.InnerXml.ToString();
nxelResults += 1;
break;
case 3:
lblResults4.Text = xelResults.InnerXml.ToString();
nxelResults += 1;
break;
case 4:
lblResults5.Text = xelResults.InnerXml.ToString();
nxelResults += 1;
break;
}
}[/code]

So, obviously, this just puts the HTML in string format and assigns it to a label, which obviously comes out with all of it's HTML markups. I want it to be formatted on my ASPX page as it would be displayed on a web page. If I'm not explaining this well, think of any RSS feed readers that allow you to add a rss feed and then read in a nice, formatted way.

Comments

Sign In or Register to comment.