html parser jsoup for beginners

I just started to learn java and the jsoup library, but immediately ran into a problem.

Why aren't tags displayed on the smartphone screen?

No compilation errors.

And one more question... Can anyone paint a good example of a html parser for a beginner, I did not find any worthy examples.

This option is also taken from the Internet, and visually as simple as possible, but it baffles me that it does not work.

public static void main(String[] args) {

    String html = "<html><head><title>Sample Title</title></head>"
            + "<body><p>Sample Content</p></body></html>";
    Document document = Jsoup.parse(html);
    System.out.println(document.title());
    Elements paragraphs = document.getElementsByTag("p");
    for (Element paragraph : paragraphs) {
        System.out.println(paragraph.text());
    }
}

I apologize for the probably stupid question ...))


Ответы (0 шт):