Answer the question
In order to leave comments, you need to log in
How to use jsoup to select only one span out of 2 in a container div?
html code
<div title class="Example">
<span>first div</span> <!---->
<span class="second div">second span</span></div>
Document doc = Jsoup.connect("example.com").get();
Elements elemenx = doc.select("div.Example span");
for (Element e: elemenx) {
System.out.println(e.text());
}
<span>first div</span>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question