Parsing A Web Page

Dec 23, 2011 at 1:24 PM

In .NET, the only "option" for dynamically parsing JavaScript embedded in a downloaded web page is to use an embedded web browser control.  Of course that is not really an option as the control is meant for a WinForms, has huge memory leaks and literally corrupts the CLR when run under load.

Ideally I would like to use JavaScript .NET to handle this work but I cannot figure out how to enable this functionality.  If I know the functions upfront it is fairly straightforward but how do you pass in a web form downloaded via an HttpWebRequest and parse any JavaScript found in that page?


Dec 27, 2011 at 10:13 PM

Javascript.NET won't help you extract JavaScript fragments from HTML; that is the browser's job.  However if you find some way to do this then Javascript.NET can run them.  But you asked about "parsing".  AFAIK the version of v8 that Javascript.NET uses does not expose the parse tree or any other intermediate form.  It can only execute it.