• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Writing XML documents to WebBrowser

Good day,

If you have a WebBrowser control on your page, you can browse to a web page by

MyWebBrowser.Navigate("www.somewhere.com")

or

MyWebBrowser.document.write("<html><body> blah blah blah </body></html>")

However, the control is always based on HTML type. I want it to be based on XML, so that I can send

MyWebBrowser.document.write("<Person TYPE="PERSON">Hello</Person>")

Currently, if I write that, all I see in the control is

Hello

But I need to see the full XML with coloring and ability to collapse portions, etc like a normal XML document opened in IExplorer.

Any ideas?
0
rose337
Asked:
rose337
1 Solution
 
TravisHallCommented:
You are making a big, incorrect assumption - namely, that IE actually displays XML. It doesn't, or at least not directly. What it actually does is apply a default XSLT stylesheet to XML documents which don't specify any other stylesheet, thus transforming them into HTML (or something close enough to valid HTML that IE can display it anyway).

What you would need to do to display the same thing in your WebBrowser control would be to apply the same stylesheet to your XML document, and display the result in the control. This would be a matter of the utmost simplicity, if we knew what that stylesheet was. But we don't, so I guess we're a little bit stuck.

I suppose we could try to reverse engineer that stylesheet, but that's something that would take more time and energy than I have to spare at the moment.

This, of course, makes my comment woefully incomplete as an answer, but that's about all I know. Maybe you can use this information as a springboard to further research. However, this comment is really just a comment, not an answer.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now