Package us.codecraft.webmagic.selector
Class XpathSelector
java.lang.Object
us.codecraft.webmagic.selector.BaseElementSelector
us.codecraft.webmagic.selector.XpathSelector
- All Implemented Interfaces:
ElementSelector
,Selector
XPath selector based on Xsoup.
- Since:
- 0.3.0
- Author:
- code4crafter@gmail.com
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
select
(org.jsoup.nodes.Element element) Extract single result in text.
If there are more than one result, only the first will be chosen.org.jsoup.nodes.Element
selectElement
(org.jsoup.nodes.Element element) List<org.jsoup.nodes.Element>
selectElements
(org.jsoup.nodes.Element element) selectList
(org.jsoup.nodes.Element element) Extract all results in text.Methods inherited from class us.codecraft.webmagic.selector.BaseElementSelector
select, selectElement, selectElements, selectList
-
Constructor Details
-
XpathSelector
-
-
Method Details
-
select
Description copied from interface:ElementSelector
Extract single result in text.
If there are more than one result, only the first will be chosen.- Parameters:
element
- element- Returns:
- result
-
selectList
Description copied from interface:ElementSelector
Extract all results in text.- Parameters:
element
- element- Returns:
- results
-
selectElement
public org.jsoup.nodes.Element selectElement(org.jsoup.nodes.Element element) - Specified by:
selectElement
in classBaseElementSelector
-
selectElements
- Specified by:
selectElements
in classBaseElementSelector
-
hasAttribute
public boolean hasAttribute()- Specified by:
hasAttribute
in classBaseElementSelector
-