JSoup is an API that simplified html parsing  due to it's jquery-like selectors.In this tutorial we will see how to parse an Html document from a given URL address.

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;


public class JSoupTest {

	
	public static void main(String args[]) {

		try {
			Document doc=Jsoup.connect("http://www.java-only.com/LoadTutorial.javaonly").data("id","3").get();

			Elements select = doc.select(".tutorialHeader");
			Document parse = Jsoup.parse(doc.html());
			System.out.println("SELECT"+parse.select(".tutorialHeader>p").text());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

 As you can see in the above example we selected the element thas has tutorialHeader css class (

select(".tutorialHeader") )

and after that we've selected the text of the direct paragraph from the div with css class tutorialHeader (

.select(".tutorialHeader>p").text()

).