Подтвердить что ты не робот

Jsoup исключает детей из .text()

У меня проблема, подобная той, что:

Можно ли получить его в JSoup?

4b9b3361

Ответ 1

Вероятно, вы ищете вызов ownText:

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

public class Main {
    public static void main(String[] args) throws Exception {
        final Document document = Jsoup.parse("<html><head/><body><a href=\"#\" class=\"artist\">Soulive<span class=\"create-play\">Play</span></a></body></html>");
        final Element elem = document.getElementsByAttributeValue("class", "artist").first();
        System.out.println(elem.ownText());
    }
}