|
Using javascript from a string of HTML source? -
December 26th, 2007
Dear all,
I am using .NET and now I have a string which contains the HTML source of a web page. The HTML source contains many HTML elements and each of them has been assigned an unique ID, an example is like this:
<div id="login"></div>
With javascript, I can get a reference to this HTML element by using document.getElementById("login")
But now the HTML source is in a string like this (VB.NET):
Dim htmlSource As String=GetHtmlSource(url)
Although you may suggest that I can use the XmlReader in .NET to manipulate the its DOM tree, the problem is that, most HTML documents are not well-formed.
Therefore, I would like to know if I can load the javascript engine of the browser in .NET, so that I can supply the HTML source and the javascript syntax to it and then obtain the returned result.
Since the javascript engine seems to be more forgiving than the XmlReader, that's why I want to use it.
Is there any library that allows me to do this?
Thank you very much.
|