user3460377
user3460377

Reputation: 13

how to get text in a div without an id or class jsoup

i have the follow problem. I want to parse a html page with jsoup. The parsing is not the problem but i need to get the text in a div without using the id or class. there is a custom attribute in the div element.

<div id="test" custom="tester">Get this text </div>

i tried the follow thing:

Element bedrijfwrapper = document.select("custom[name="tester"].first();

but i dont't get it to work. Can someone help me out?

Upvotes: 1

Views: 702

Answers (2)

Stijn
Stijn

Reputation: 359

This might work:

doc.select("div[custom=tester]")

Upvotes: 0

hacks4life
hacks4life

Reputation: 693

You should try this :

document.select('[custom="tester"]').first();

Good luck.

Upvotes: 1

Related Questions