Elements ps = body.select("p:not(.random_class_name)");
You can use pseudo selector :not
If the class name is unknown, you can still use a similar expression:
Elements ps = body.select("p:not([class])");
In the second example, I use the attribute selector [], in the first - the usual syntax for classes.
See Jsoup doc on css selectors
source
share