Loading and Executing the jquery and javascript scripts using Java or any other language -


we have need parse , extract content html files. thinking of using jquery navigate dom , extract small piece of information. found javascript library written in java mozilla. using libary, tried load file called file.js includes jquery script few lines of jquery script code shown below.

var content = $('<html> <body><div id="div1"><span> hello world!</span></div></body></html>').find('div span').html(); print("content = " + content); print("hello"); 

we got errors related undefined document, navigator etc. in jquery library. can please how run jquery scripts java or c# parse html files.

using rhino java fine, have aware of fact javascript not define dom api.

it instead role of navigator embeds javascript engine.

you need initialize dom yourself, using example script found here: http://ejohn.org/blog/bringing-the-browser-to-the-server/

which allows run jquery, according author, , load html code in `virtual' page emulated in environment.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -