Java HTMLEditorKit 中取得html的text?# Java - 爪哇娇娃
l*r
1 楼
Hi,
I am using HTMLEditorKit trying to parse a html.
My purpose is to get the text content of a HTML file, and also the URLs
in this HTML file. But how can I do it?
I saw a demo file looks like (where r is the html file):
HTMLEditorKit.Parser parser;
System.out.println("About to parse " + spec);
parser = new ParserDelegator();
parser.parse(r, new HTMLParseLister(), true);
The above code output everything to screen. I think I should replace
the "new HTMLParseLister
I am using HTMLEditorKit trying to parse a html.
My purpose is to get the text content of a HTML file, and also the URLs
in this HTML file. But how can I do it?
I saw a demo file looks like (where r is the html file):
HTMLEditorKit.Parser parser;
System.out.println("About to parse " + spec);
parser = new ParserDelegator();
parser.parse(r, new HTMLParseLister(), true);
The above code output everything to screen. I think I should replace
the "new HTMLParseLister