为WebBrowser控件增加显示XML文档接口(c#)
Show XML in WebBrowser control
https://learn.microsoft.com/en-us/answers/questions/1181957/show-xml-in-webbrowser-control
View XML Files Easily with XmlGridViewControl
https://www.codeproject.com/articles/16497/view-xml-files-easily-with-xmlgridviewcontrol
Winform: use the WebBrowser to display XML with xslt, xml, xslt 转 html 字符串声明xml字符串:
string xml = "....";
声明xslt 转换类:
XslCompiledTransform xslt = new XslCompiledTransform();
调用xslt sheet文件:
xslt.Load("XSLTFile1.xslt");
将字符串转成流类型
TextReader tr = new StringReader(xml);
声明XPathDocument 类
XPathDocument xpath = new XPathDocument(tr);
定义写字符串的流类型
TextWriter tw = new StringWriter();
定义xml输出流:
XmlWriter xwriter = XmlWriter.Create(tw);
将xml 转成 html 字符串
xslt.Transform(xpath, xwriter);
WebBrowser输出html:
标签:xml,XML,xslt,WebBrowser,new,字符串,webbrowser From: https://www.cnblogs.com/net-saiya/p/17650135.htmlwebBrowser1.DocumentText = tw.ToString();