如何使用 WebBrowser 控件显示 XML? [英] How can I display XML with WebBrowser control?

查看:38
本文介绍了如何使用 WebBrowser 控件显示 XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 xmlstring.我想用它设置 WebBrowser 控件的值并显示为 xml.

I have a string that contains a xml. I want to set the value of the WebBrowser control with it and display as a xml.

我可以使用 browser.DocumentText 设置该值,但是如何让它显示为 XML 呢?

I can set the value with browser.DocumentText, but how do I tell it to display as a XML ?

推荐答案

不是特别容易,但可能.要么将字符串保存在 xml 文件中,然后使用 Navigate() 将其加载回来(糟糕...),要么将 xsl 应用到 xml(不开玩笑!),像 IE 浏览器一样呈现它.

Not particularly easy but possible. Either you save your string in a xml file and load it back using Navigate() (yuck...), or you apply a xsl to your xml (no kidding!) that renders it like the IE browser does.

见:

http://social.msdn.microsoft.com/Forums/en/winforms/thread/18ca6734-ddb7-4f44-a77c-9a7713dcc2e1

这篇关于如何使用 WebBrowser 控件显示 XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆