Java jsoup getElements MatchingOwn Text(其单一方法spilited限制)识别html元素的示例
有谁能帮我举个例子,在jsoup中使用Java jsoup getElements MatchingOwn Text(其单一方法spilited限制)识别html元素的示例,java,jsoup,Java,Jsoup,有谁能帮我举个例子,在jsoup中使用getElementsMatchingOwnText来识别html页面中的确切元素,可能有两个类似status的文本,newstatus方法应该status作为参数传递,而不是newstatus,如果它首先出现的话 提前谢谢你这是你需要的吗 示例html: <html> <head></head> <body> <p>new status</p> <p>statu
getElementsMatchingOwnText
来识别html页面中的确切元素,可能有两个类似status的文本,newstatus方法应该status作为参数传递,而不是newstatus,如果它首先出现的话
提前谢谢你这是你需要的吗
示例html:
<html>
<head></head>
<body>
<p>new status</p>
<p>status</p>
</body>
</html>
Document doc = ...
for( Element element : doc.getElementsMatchingOwnText("(?i)^status$") )
{
System.out.println(element);
}
<p>status</p>
输出:
<html>
<head></head>
<body>
<p>new status</p>
<p>status</p>
</body>
</html>
Document doc = ...
for( Element element : doc.getElementsMatchingOwnText("(?i)^status$") )
{
System.out.println(element);
}
<p>status</p>
你能发布你的输入html吗?如果没有来自提问者的更多信息,这似乎就是答案。投票表决编辑:我说没有更多信息意味着,除非他/她澄清这是他们需要的。