开发者

Good way to fetch XML from a remote URL, convert it to HTML and display it in a ASP.NET-page

The use case I want to achive is.

1. Fetch XML from a remote URL.
2. Convert it to HTML using XSLT
3. Insert the generated HTML at a position in my ASP.NET web forms page.

Alternative on the above, if 1 returns a 404:

2. Generate HTML which display an error message to the user.

Only step 3 is left as I've completed 1-2. As there are logic for handling the two execution paths and performing the XSLT-transformation I thought it would be suitable to keep it in the code-behind file.

What's a good, clean way of insertin开发者_JAVA百科g generated HTML at a position in my ASP.NET web forms page?


If you've got the HTML as a string, you can add a literal to your web form:

<asp:Literal id="litHtml" runat="server" />

and set its value in your code behind:

litHtml.Text = "Your HTML";


1- Use XmlDocument.Load MSDN

2/3- use A asp:Xml server control (MSDN) with a tranformsource (MSDN , and initialize youXmlServerControl.Document (MSDN) with the XmlDocument from 1/

Ask if i'm not clear.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜