Displaying XML in WebBrowser control
December 18, 2007
This is one of those “how can this be hard stuff”, and after checking the Net i couldn’t find anything much about how to do it.
The case is as follow; say that you have some XML that you want to display to the user. What better way than to use the nice format used by Internet Explorer itself. So you use the WebBrowser control in Visual Studio 2005 and simply pour the XML into the DocumentText-property… But hey - where are my tags? Where is the formatting?
So how do you display XML in the WebBrowser then? Well the simplest way is to save the XML-file to disk and simply start it with Process.Start. This might also be quite enough for some solutions.
But if you need to do this over and over you want to work with the XML-file in memory. In order to get the nice formatting...