XmlDataSource: How to render HTML data?

  • Thread starter Thread starter Thor W Hammer
  • Start date Start date
T

Thor W Hammer

Is it possible to use XmlDataSource control to transform a xml-file to html
and having the html rendered on the page?

Kind regards,
Twh
 
Thor,

If I'm understanding your question correctly you want to show the entire xml
file on the page?

If that's the case then I don't think you would want to use the
XMLDataSource. It will let you iterate through the nodes, but you'd have to
loop through everything in the file inserting html tags where necessary.

A much more efficient way would be to access the xml file via the System.IO
and then response.write the file contents as a string. You'll want to
Server.HtmlEncode the string so that the tags (i.e. <, >, etc.) will appear
properly. Then you could even get into setting font colors for the tags by
parsing the string if you wanted.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
Back
Top