在WebBrowser控件中显示XML

在WebBrowser控件中显示XML

本文介绍了在WebBrowser控件中显示XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试在WebBrowser控件中显示XML。我收到了一个 XML的数据源,我正在尝试将其注入控件。我没有成功 这样做。 我找到的唯一解决方案是将它写入临时文件然后使用 用于加载它的Navigate方法。由于控件能够从 磁盘加载它,我想找到一种方法来跳过保存/加载并注入。 谢谢, Dave 解决方案 什么样的XML显示?你在找?在IE浏览器窗口中加载XML文档时,您可以获得的XML源代码树的可折叠非常好吗??这是通过使用MSXML的IE 应用的XSL样式表完成的。不幸的是,如果你有一个带有 标记的字符串,我不认为有可能获得 IE或WebBrowser控件。然而,你在.NET 2.0应用程序中可以做的是用.NET运行XSLT转换以将XML转换为HTML然后 设置控制。 - Martin Honnen --- MVP XML http://javaScript.FAQTs.com/ 什么样的XML显示?你在找?在IE浏览器窗口中加载XML文档时,您可以获得的XML源代码树的可折叠非常好吗??这是通过使用MSXML的IE 应用的XSL样式表完成的。不幸的是,如果你有一个带有 标记的字符串,我不认为有可能获得 IE或WebBrowser控件。然而,你在.NET 2.0应用程序中可以做的是用.NET运行XSLT转换以将XML转换为HTML然后 设置控制。 - Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ 经验证 - 有关详细信息,请参阅XPath Visualizer的代码。 另一条评论:defaultss.xsl不是用XSLT编写,我们知道。 干杯, Dimitre Novatchev " Martin Honnen" < ma ******* @ yahoo.dewrote in message news:eN ************* @ TK2MSFTNGP06.phx.gbl ... 什么样的XML显示?你在找?当您在IE浏览器窗口中加载XML文档时,您获得的XML源代码树的可折叠相当可靠吗?这是通过IE使用MSXML应用 的XSL样式表完成的。不幸的是,如果你有一个带有标记的字符串,我不认为有可能获得IE或 WebBrowser控件来做到这一点。你在.NET 2.0应用程序中可以做的事情是,用.NET运行XSLT 转换,将XML转换为HTML,然后设置 控件的DocumentText属性。 - Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ I am trying to display XML in a WebBrowser Control. I receive a data feed ofXML and am trying to inject it into the control. I have not been successfulin doing so.The only solution I have found is to write it to a temp file and then usethe Navigate method to load it. As the control is capable of loading it fromdisk, I would like to find a way to skip the save/load and just inject.Thanks,Dave 解决方案What kind of "XML display" are you looking for? That collapsible prettyprint of the XML source tree that you get when you load an XML documentin an IE browser window? That is done with an XSL stylesheet that IEapplies using MSXML. Unfortunately I don''t think it is possible to getIE or the WebBrowser control to do that if you have a string withmarkup. What you could do in a .NET 2.0 application however is to runthe XSLT transformation with .NET to transform the XML to HTML and thenset the DocumentText property of the control.--Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/What kind of "XML display" are you looking for? That collapsible prettyprint of the XML source tree that you get when you load an XML documentin an IE browser window? That is done with an XSL stylesheet that IEapplies using MSXML. Unfortunately I don''t think it is possible to getIE or the WebBrowser control to do that if you have a string withmarkup. What you could do in a .NET 2.0 application however is to runthe XSLT transformation with .NET to transform the XML to HTML and thenset the DocumentText property of the control.--Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/Proven possible -- see the code of the XPath Visualizer for details.Another remark: defaultss.xsl is not written in XSLT, as we well know.Cheers,Dimitre Novatchev"Martin Honnen" <ma*******@yahoo.dewrote in messagenews:eN*************@TK2MSFTNGP06.phx.gbl...What kind of "XML display" are you looking for? That collapsible prettyprint of the XML source tree that you get when you load an XML document inan IE browser window? That is done with an XSL stylesheet that IE appliesusing MSXML. Unfortunately I don''t think it is possible to get IE or theWebBrowser control to do that if you have a string with markup. What youcould do in a .NET 2.0 application however is to run the XSLTtransformation with .NET to transform the XML to HTML and then set theDocumentText property of the control.--Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ 这篇关于在WebBrowser控件中显示XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-27 00:24