JAVA解析html

来源:百度知道 编辑:UC知道 时间:2024/05/30 01:19:26
哥哥姐姐们谁能告诉我解析HTML,把里面的东西读出来,然后保存到数据库中,最好详细点 哥哥姐姐们谁能告诉我解析HTML,最好详细点

吧源文件找到,去掉html的符号就可以啦。给你看一段我写的,写的不好,还得改呢(*^__^*) 嘻嘻……:
public String HtmlToTextGb2312(String inputString)
{
String htmlStr = inputString; //含html标签的字符串
String textStr ="";
Pattern p_script;
Matcher m_script;
Pattern p_style;
Matcher m_style;
Pattern p_html;
Matcher m_html;
Pattern p_houhtml;
Matcher m_houhtml;
Pattern p_spe;
Matcher m_spe;
Pattern p_blank;
Matcher m_blank;
Pattern p_table;
Matcher m_table;
Pattern p_enter;
Matcher m_enter;

try {
String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*