在字符串中:
"<span >x </span><span >y</span> <span >z</span>"
我想提取第三个<span>
标签中的数据,即“z”。如何直接引用第三个?
import org.jsoup.*;
import org.jsoup.nodes.*;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
String str = " <span >x </span> <span >y</span> <span> z </span> ";
Document doc = Jsoup.parse(str);
Elements link = doc.getElementsByTag("span");
for (Element link2 : link)
{
p= link.text();
}