网页浏览器.传递XMLDocument [英] webBrowser. passing XMLDocument

查看:84
本文介绍了网页浏览器.传递XMLDocument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的window应用程序中,我集成了gmap.现在我要调用javascript函数.在这里我想通过XmlDocument.

但是当我想看看我通过了什么. alert("hi" + result)它只显示Hi而不显示xml数据


Hi,

In my windowapplication I integrate gmap. Now I want to call javascript function. Here I want to pass XmlDocument.

But when I want to see what I passed. alert("hi"+result) it shows only Hi not xml data


System.Xml.XmlDocument d = DataConnection.GetRecentInfos("1021");
             try
             {
                 object[] arg ={d};
                 webBrowser1.Document.InvokeScript("OnComplete",arg);
             }


请告诉我该怎么解决

谢谢


Please tell me how can I solve it

Thanks

推荐答案

在警报中显示XML数据时,应使用
对其进行编码
When Displaying XML Data inside alert you should encode it using

HttpUtility.HtmlEncode(result);



否则浏览器将尝试将其读取为HTML.



otherwise the browser will try to read it as HTML.


try

try

System.Xml.XmlDocument d = DataConnection.GetRecentInfos("1021");
             try
             {
                 object[] arg ={d.OuterXml};
                 webBrowser1.Document.InvokeScript("OnComplete",arg);
             }


这篇关于网页浏览器.传递XMLDocument的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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