pub struct WalkQuery { /* private fields */ }Expand description
A parsed query inside the walk’s grammar (see the module doc).
Implementations§
Source§impl WalkQuery
impl WalkQuery
Sourcepub fn parse(xpath: &str) -> Option<WalkQuery>
pub fn parse(xpath: &str) -> Option<WalkQuery>
The query xpath as a walk, or None when it is outside the grammar: a union (|) of //STEP, //A//STEP or
//A/STEP arms (A a bare name test), or of descendant::STEP / .//STEP / descendant-or-self::STEP arms,
where STEP is * or ltx:NAME with at most one predicate of or/and-joined atoms (no parentheses).
Sourcepub fn find(&self, doc: &Document, context: Option<&Node>) -> Option<Vec<Node>>
pub fn find(&self, doc: &Document, context: Option<&Node>) -> Option<Vec<Node>>
The query’s matches in doc, in document order, each once: XPath’s answer, evaluated at context (or at the
root element when None, as LaTeXML’s findnodes binds it). None when the walk cannot vouch for that: no root,
a null context or one outside doc’s tree (a detached or foreign node: XPath decides how it fails), or a DTD
(its default attributes and entity references are seen differently by XPath than by a tree walk).