Monday, June 04, 2012

How to easily load web page straight to the DOM

Very useful and light-weight package you may find here. It allows to wrap any html page from the server straight to DOM with no cost at all. Like this one:

org.jsoup.nodes.Document doc = Jsoup.connect("http://yourpage.own").get();

After that you may operate with doc like with just regular document. Another useful thing is locating element using css selector syntax. Here is the example from the official page

Document doc = Jsoup.connect("").get();
Elements newsHeadlines ="#mp-itn b a");
Powerful tool with broad functionality which is better to get familiar with through the official page.