Reputation: 1057
I am new to java, and want to use the jsoup java library. I downloaded the jar file, and included it in my project. Next, I want to run a simple example, on their page
String html = "<html><head><title>First parse</title></head>"
+ "<body><p>Parsed HTML into a doc.</p></body></html>";
Document doc = Jsoup.parse(html);
On second line I get error:
Type mismatch: cannot convert from org.jsoup.nodes.Document to
javax.swing.text.Document
And offers:
Add 'cast' to document or change type (org.jsoup.nodes.Document doc = Jsoup.parse(html);)
What is the problem? Have I forgotten to do something?
Upvotes: 1
Views: 1101
Reputation: 10727
Check your imports at the top of your program, most surely you're importing javax.swing.text.Document
when you want to import org.jsoup.nodes.Document
Upvotes: 6
Reputation: 18173
Change the type of doc
to the appropriate type offered by Eclipse - although the two Document
types have the same name, they are not the same.
Upvotes: 0