mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-12 14:46:03 +00:00
xml.xpath(expression[, variables]) evaluates an XPath 1.0 expression (https://www.w3.org/TR/1999/REC-xpath-19991116/) with the XML value as the context node and returns the selected nodes as an XMLList, in document order and without repeats. On an XMLList the expression runs on each element in turn, and the results are joined. - All 13 axes and the 27 core functions. id() selects nothing, since E4X trees carry no DTD data. - Each property of `variables` binds the variable of its name. A prefix in a name test resolves through the context element's in-scope namespaces; `xml` is always bound. - An expression that breaks the grammar gives a SyntaxError. An unknown function, a wrong argument count, an unbound prefix or variable, a result that is not a node-set, and a result that holds the root or a namespace node give a TypeError. - The parser and the evaluator keep their state on their own stacks, so expressions of any depth use no native stack; nesting past Options::max_depth gives "nesting too deep". Traversal stacks, node lists, strings and the values that string functions build count against the heap limit, and every node visited and string read takes fuel. Docs: docs/target-app-parity.md (E4X line), crate doc in lib.rs.