I
I
Igor2015-06-13 12:38:25
Java
Igor, 2015-06-13 12:38:25

How to parse tags with names containing spaces in Java JSOUP?

Hello.
I use Java, JSOUP for parsing web pages.
With a tag
<div class="page">
, the code looks like this
Elements elements = doc.select("div.page");
. But how to parse with such a tag?
<div class="page-list-item container ">

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Emin, 2015-06-13
@cawendish

Trydoc.select("div.page-list-item.container");

A
anyd3v, 2015-06-13
@anyd3v

You should at least learn the basics, what you call "how to parse with such a tag" is just listing the classes of the tag in html. In order to specify several classes for filtering in jsoup, Emin almost told you, but no spaces are needed, the final version will be: "div.page-list-item.container" (without any spaces) Read jsoup
to improve skills .org/cookbook/extracting-data/selector-syntax
For testing online try.jsoup.org
The very question of the level: I don’t want to study anything I want to be decided for me

V
Valera-0, 2021-03-17
@Valera-0

Emin and anyd3V thanks, I've been thinking for a whole day, but it turns out the problem is in the gap.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question