Struct sxd_xpath::XPath
[−]
[src]
pub struct XPath(_);
A compiled XPath. Construct via Factory
.
Methods
impl XPath
[src]
fn evaluate<'d, N>(
&self,
context: &Context<'d>,
node: N
) -> Result<Value<'d>, ExecutionError> where
N: Into<Node<'d>>,
&self,
context: &Context<'d>,
node: N
) -> Result<Value<'d>, ExecutionError> where
N: Into<Node<'d>>,
Evaluate this expression in the given context.
Examples
The most common case is to pass in a reference to a Context
:
extern crate sxd_document; extern crate sxd_xpath; use sxd_document::dom::Document; use sxd_xpath::{XPath, Context}; fn my_evaluate(doc: Document, xpath: XPath) { let mut context = Context::new(); let value = xpath.evaluate(&context, doc.root()); println!("The result was: {:?}", value); }