diff --git a/lib/src/xpath/evaluation/context.dart b/lib/src/xpath/evaluation/context.dart index 87aed5e..3cc38e8 100644 --- a/lib/src/xpath/evaluation/context.dart +++ b/lib/src/xpath/evaluation/context.dart @@ -2,6 +2,7 @@ import '../../xml/nodes/node.dart'; import 'functions.dart'; import 'values.dart'; +/// Runtime execution context to evaluate XPath expressions. class XPathContext { XPathContext( this.node, { @@ -11,12 +12,16 @@ class XPathContext { this.functions = const {}, }); + /// Mutable context node. XmlNode node; + /// Mutable context position. int position = 1; + /// Mutable context size. int last = 1; + /// The current node as an [XPathValue]. XPathValue get value => XPathNodeSet([node]); /// Looks up an XPath variable with the given [name]. @@ -26,10 +31,13 @@ class XPathContext { XPathFunction? getFunction(String name) => functions[name] ?? standardFunctions[name]; + /// User-defined variables. final Map variables; + /// User-defined functions. final Map functions; + /// Creates a copy of the current context. XPathContext copy() => XPathContext( node, position: position,