我如何使用解析器? [英] How can i use the parser?

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

问题描述

我在我的应用程序中使用了解析器但是我无法正常运行。

我对解析器的输入是一个html文件,我想在JavaScript代码中运行命令和链接,它会给出解析器jurassic中的输出。



我的代码是:

I used the parser in my application but I cannot run properly.
My input to the parser is a html file and I want to run the commands and links within JavaScript code, it will give the output in the parser jurassic.

My code is :

var engine = new Jurassic.ScriptEngine();
                           var scriptsource = new Jurassic.StringScriptSource(Uri.UnescapeDataString(html), null);



和:


and :

try
                           {
                               var ans = engine.Evaluate(Uri.UnescapeDataString(u1.URI.AbsolutePath));
                               u1 = new URL(engine.GetGlobalValue("document.location.href").ToString());
                           }

                           catch (Exception ex)
                           {
                               System.Windows.Forms.MessageBox.Show(ex.Message);
                           }



当我跟踪我的代码时,这部分它不会运行。是否还有其他代码?

和某些网址(例如bg.888.com),jurassic无法运行有javascript链接的函数。


When i trace my code, this part, it does not run. Is there another code for it?
and for some url (for example bg.888.com), jurassic can not run functions that there is javascript links.

推荐答案

我认为它应该是这样的:



I think it should be like this:

// First, give U1 a value...
u1 = new URL(engine.GetGlobalValue("document.location.href").ToString());
// ... and only later use it.
var ans = engine.Evaluate(Uri.UnescapeDataString(u1.URI.AbsolutePath));





希望这会有所帮助,

Pablo



Hope this helps,
Pablo


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

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