当前位置: 技术问答>java相关
有没有函数从html文本中获取纯文本内容???
来源: 互联网 发布时间:2015-05-25
本文导语: 我需要从html文件中获取正文内容,有没有函数从html文本中获取纯文本内容???急用!!!!,谢谢了 | 可以用java文件流来读取。 然后判断html的标志关键字:如果是正文则读取。 html的标...
我需要从html文件中获取正文内容,有没有函数从html文本中获取纯文本内容???急用!!!!,谢谢了
|
可以用java文件流来读取。
然后判断html的标志关键字:如果是正文则读取。
html的标志关键字,自己去查吧(如:...)
然后判断html的标志关键字:如果是正文则读取。
html的标志关键字,自己去查吧(如:...)
|
不建议你自己处理,最好找个合适的Html解析器
如果需要自己处理,也请使用正则表达式来匹配
如果需要自己处理,也请使用正则表达式来匹配
|
你想要HTML parser吗,我这里有个,给你EMAIL我,我寄信给你。
但我没有测试过。
但我没有测试过。
|
我建议你看看:
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
public class worldheart {
public static void main(String args[])
throws IOException {
// check command-line arguments
if (args.length != 2) {
System.err.println("missing filenames");
System.exit(1);
}
// get channels
FileInputStream fis =
new FileInputStream(args[0]);
FileOutputStream fos =
new FileOutputStream(args[1]);
FileChannel fcin = fis.getChannel();
FileChannel fcout = fos.getChannel();
// allocate buffer
ByteBuffer buf =
ByteBuffer.allocateDirect(8192);
// do copy
long size = fcin.size();
long n = 0;
while (n
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
public class worldheart {
public static void main(String args[])
throws IOException {
// check command-line arguments
if (args.length != 2) {
System.err.println("missing filenames");
System.exit(1);
}
// get channels
FileInputStream fis =
new FileInputStream(args[0]);
FileOutputStream fos =
new FileOutputStream(args[1]);
FileChannel fcin = fis.getChannel();
FileChannel fcout = fos.getChannel();
// allocate buffer
ByteBuffer buf =
ByteBuffer.allocateDirect(8192);
// do copy
long size = fcin.size();
long n = 0;
while (n
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
站内导航:
特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!