Here you can find the source of detectLanguage(Document doc)
public static String detectLanguage(Document doc)
//package com.java2s; //License from project: Apache License import org.jsoup.nodes.*; public class Main { public static String detectLanguage(Document doc) { Element htmlTag = doc.select("html").first(); if (htmlTag.attributes().hasKey("lang")) { return htmlTag.attr("lang"); }// w w w . java 2s . co m if (htmlTag.attributes().hasKey("xml:lang")) { return htmlTag.attr("xml:lang"); } return null; } }