zl程序教程

您现在的位置是:首页 >  后端

当前栏目

java将html转换为纯文本的代码详解编程语言

2023-06-13 09:20:30 时间
ParserDelegator delegator = new ParserDelegator(); // the third parameter is TRUE to ignore charset directive delegator.parse(in, this, Boolean.TRUE); public void handleText(char[] text, int pos) { s.append(text); public String getText() { return s.toString(); public static void main (String[] args) { try { // the HTML to convert FileReader in = new FileReader("java-new.html"); Html2Text parser = new Html2Text(); parser.parse(in); in.close(); System.out.println(parser.getText()); catch (Exception e) { e.printStackTrace(); }

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/10880.html

cjava