Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何从网页中提取动态文本_Java_Web Services - Fatal编程技术网

Java 如何从网页中提取动态文本

Java 如何从网页中提取动态文本,java,web-services,Java,Web Services,我想从经常更改的网页中获取一些文本。我使用的技术是什么?例如,每天都在更改的汇率,我想从网页中提取并保存在DB中,请让我知道任何人都知道这一点 thanxx可以用来解析HTML 例如: String html = "<p>An <a href='http://example.com/'><b>example</b></a> link.</p>"; Document doc = Jsoup.parse(html); Eleme

我想从经常更改的网页中获取一些文本。我使用的技术是什么?例如,每天都在更改的汇率,我想从网页中提取并保存在DB中,请让我知道任何人都知道这一点

thanxx可以用来解析HTML

例如:

String html = "<p>An <a href='http://example.com/'><b>example</b></a> link.</p>";
Document doc = Jsoup.parse(html);
Element link = doc.select("a").first();

String text = doc.body().text(); // "An example link"
String linkHref = link.attr("href"); // "http://example.com/"
String linkText = link.text(); // "example""

String linkOuterH = link.outerHtml(); 
    // "<a href="http://example.com"><b>example</b></a>"
String linkInnerH = link.html(); // "<b>example</b>"
String html=“链接。

”; Document doc=Jsoup.parse(html); Element link=doc.select(“a”).first(); 字符串text=doc.body().text();//“示例链接” 字符串linkHref=link.attr(“href”);//"http://example.com/" 字符串linkText=link.text();//“示例” 字符串linkOuterH=link.outerHtml(); // "" 字符串linkInnerH=link.html();/“示例”

您可以查找特定的DIV,以这种方式标记,检查

感谢您的快速响应!!如果这是您的答案,欢迎您接受/投票