How do you use HtmlToPlainText() method from org.jsoup.examples -


mind i've been programming in java 1 week on crash course gentle. i'm writing program take online news article , reader comments , converting them graphml document , i've been getting hang of java , jsoup i'm trying convert comments lightly formatted plain-text lines

elements comments = qadoc.select("li[data-comment-id]");  (element comment : comments) {  //code    commenttext = comment.select("div[class$=d2-body]").first().htmltoplaintext();  //code  } 

but keep getting "error: cannot find symbol" pointing .htmltoplaintext() when try compile

i've put

import java.lang.object; import org.jsoup.examples.htmltoplaintext;

at beginning of class along other imports necessary can't find source htmltoplaintext it's not in cookbook listlinks way not using eclipse ide yet je editor , command prompt in windows thanks

htmltoplaintext class in jsoup library, , "method" try call it's constructor, not able compile , run code have far.

since code incomplete, assume commenttext simple string-representation of comment, , should able following achieve want:

commenttext = comment.select("div[class$=d2-body]").first().text(); 

which return string text , it's children.

you can use simple tostring()-method.

commenttext = comment.select("div[class$=d2-body]").first().tostring(); 

i recommend consult jsoup api, can out lot. in 'examples'-subpackage can find class htmltoplaintext.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -