|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jsoup.select.Selector
public class Selector
CSS-like element selector, that finds elements matching a query.
*.header
and .header
is equivalent).
Pattern | Matches | Example | |
---|---|---|---|
* | any element | * | |
E | an element of type E | h1 | |
E#id | an Element with attribute ID of "id" | div#wrap , #logo | |
E.class | an Element with a class name of "class" | div.left , .result | |
E[attr] | an Element with the attribute named "attr" | a[href] , [title] | |
E[attr=val] | an Element with the attribute named "attr" and value equal to "val" | img[width=500] , a[rel=nofollow] | |
E[attr^=val] | an Element with the attribute named "attr" and value starting with "val" | a[href^=http:] | |
E[attr$=val] | an Element with the attribute named "attr" and value ending with "val" | img[src$=.png] | |
E[attr*=val] | an Element with the attribute named "attr" and value containing "val" | a[href*=/search/] | |
The above may be combined in any order | div.header[title] | ||
Combinators | |||
E F | an F element descended from an E element | div a , .logo h1 | |
E > F | an F child of E | ol > li | |
E + F | an F element immediately preceded by sibling E | li + li , div.head + div | |
E ~ F | an F element preceded by sibling E | h1 ~ p | |
E, F, G | any matching element E, F, or G | a[href], div, h3 |
Element.select(String)
Nested Class Summary | |
---|---|
static class |
Selector.SelectorParseException
|
Method Summary | |
---|---|
static Elements |
select(String query,
Element root)
Find elements matching selector. |
static Elements |
select(String query,
Iterable<Element> roots)
Find elements matching selector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Elements select(String query, Element root)
query
- CSS selectorroot
- root element to descend into
public static Elements select(String query, Iterable<Element> roots)
query
- CSS selectorroots
- root elements to descend into
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |