Queryable
public protocol Queryable
- The
Queryable
protocol is adopted byXMLDocument
,HTMLDocument
andXMLElement
, denoting that they can search for elements using XPath or CSS selectors.
-
Returns the results for an XPath selector.
Declaration
Swift
func xpath(xpath: String) -> XPathNodeSet
Parameters
xpath
XPath selector string.
Return Value
An enumerable collection of results.
-
Returns the first elements matching an XPath selector, or
nil
if there are no results.Declaration
Swift
func firstChild(xpath xpath: String) -> XMLElement?
Parameters
xpath
The XPath selector.
Return Value
The child element.
-
Returns the results for a CSS selector.
Declaration
Swift
func css(css: String) -> XPathNodeSet
Parameters
css
The CSS selector string.
Return Value
An enumerable collection of results.
-
Returns the first elements matching an CSS selector, or
nil
if there are no results.Declaration
Swift
func firstChild(css css: String) -> XMLElement?
Parameters
css
The CSS selector.
Return Value
The child element.
-
Returns the result for evaluating an XPath selector that contains XPath function.
Declaration
Swift
func eval(xpath xpath: String) -> XPathFunctionResult?
Parameters
xpath
The XPath query string.
Return Value
The eval function result.