使用Java从HTML页面中截取数据,输出到数据库 [英] Scrape data from HTML pages using Java, output to database
问题描述
我需要知道如何创建一个刮刀(用Java)从HTML页面收集数据并输出到数据库...没有线索从哪里开始所以你可以给我的任何信息都很棒。此外,你在这里不能太基本或简单...谢谢:)
I need to know how to create a scraper (in Java) to gather data from HTML pages and output to a database...do not have a clue where to start so any information you can give me on this would be great. Also, you can't be too basic or simple here...thanks :)
推荐答案
首先你需要熟悉一个 HTML
DOM
Java中的解析器,如 JTidy 。这将帮助您从 HTML
文件中提取所需的内容。一旦掌握了基本内容,就可以使用 JDBC
来放入数据库
。
First you need to get familiar with a HTML
DOM
parser in Java like JTidy. This will help you to extract the stuff you want from a HTML
file. Once you have the essential stuff, you can use JDBC
to put in the database
.
为这项工作使用正则表达式可能很诱人。但不要。 HTML不是常规语言,所以正则表达式不是那样。
It might be tempting to use regular expression for this job. But don't. HTML is not a regular language so regex are not the way to go.
这篇关于使用Java从HTML页面中截取数据,输出到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!