XmlDataSource: How to render HTML data?

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
 
S

S. Justin Gengo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top