/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication15;
import java.io.IOException;
import javax.lang.model.element.Element;
import javax.lang.model.util.Elements;
import javax.swing.text.Document;
import org.jsoup.Jsoup;
public class JavaApplication15 {
public static void main(String[] args) {
Document doc;
try {
// need http protocol
doc = Jsoup.connect("http://google.com").get();//this line generates error:
required: javax.swing.text.Document
found: org.jsoup.nodes.Document
// get page title
String title = doc.title();
System.out.println("title : " + title);
// get all links
Elements links = doc.select("a[href]");
for (Element link : links) {
// get the value from href attribute
System.out.println("\nlink : " + link.attr("href"));
System.out.println("text : " + link.text());
}
} catch (IOException e) {
e.printStackTrace();
}
}
i have jsoup imported cant fiqure out whats wrong as i took this codde from jsoup website thanks.
}