Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

Get Title From HTML

In this example, we will get the title of the HTML page from the HTML file. To do so, we are going to call Jsoup.parse() method that returns the reference of Document. The title() method of Document class returns the title of the HTML document.

  1. import;
  2. import;
  3. import org.jsoup.Jsoup;
  4. import org.jsoup.nodes.Document;
  5. public class JsoupPrintTitlefromHtml{
  6.     public static void main( String[] args ) throws IOException{
  7.                 Document doc = Jsoup.parse(new File(“e:\\register.html”),”utf-8″);
  8.                 String title = doc.title();
  9.                 System.out.println(“title is: ” + title);
  10.     }
  11. }


title is: Please Register