- laz2_xpath.pas provides an implementation of the XML Path Language (XPath) for Free Pascal. It is based on the xpath.pp unit from the Free Component Library (FCL). + laz2_xpath.pas provides an implementation of the XML Path Language (XPath) for the Lazarus IDE. It is based on the xpath.pp unit from the Free Component Library (FCL).
Copyright (c) 2000 - 2003 by Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org @@ -22,17 +22,21 @@
+ This file is part of the
- TXPathConstantNode is a TXPathExprNode descendant that represents an XPath predicate expression which contains a Literal value (any value surrounded by Quotation Marks). The return value is the TXPathVariable passed to the constructor for the class instance. + TXPathConstantNode is a TXPathExprNode descendant that represents an XPath predicate expression which contains a literal value (any value surrounded by Quotation Marks). The return value is the TXPathVariable passed to the constructor for the class instance.
+ The context node and the XPath environment arguments are not used in the method. +
+
TXPathVariableNode is a TXPathExprNode descendant that represents an XPath Variable Reference expression in the XPath syntax. For example:
@@ -463,8 +448,6 @@
Evaluate is an overridden TXPathVariable function that implements the method defined in the ancestor class. Evaluate is used to derive the value for the function call using any arguments found in the XPath expression, and to store the result in the TXPathVariable return value. @@ -573,18 +548,12 @@
+ Used in the implementation of the TXPathMathOpNode class. +
++ Used in the implementation of the TXPathCompareNode class. +
++ Create is the constructor for the class instance, and calls the inherited method on entry. Create uses AResolver as the value for the Resolver property in AScanner. It also updates the internal root node for the expression retrieved by calling the ParseOrExpr method in AScanner. +
++ Create raises an EXPathEvaluationError exception if the scanner contains unused token after evaluating the XPath expression and the CompleteExpression argument is set to True. +
++ EvaluateXPathExpression is a TXPathVariable function used to locate and return a node or tree of nodes that match the XPath expression specified in AExpressionString. AExpressionString is similar to a SQL query, and is used to navigate and select DOM nodes found in the AContextNode argument. XPath syntax is defined in the specification located at: +
+
+
+ AContextNode is a DOM node in an existing XML document, and provides the node tree searched in the routine. It may be be the root element in an XML document, but may also contain one the child nodes in a document to perform a limited search. +
++ AResolver is a TXPathNSResolver instance which allows namespace prefixes and URLs to be validated while evaluating the XPath expression. It is an optional argument (the default value is Nil), and when omitted causes only the namespaces defined in AContextNode to be considered valid. The resolver instance must be created (when needed) using a DOM node which contains the namespace declarations for node prefixes that can be included in the XPath expression, and the nodes in the result set. +
++ EvaluateXPathExpression creates a TXPathScanner instance used to parse and process the XPath expression, and to compare DOM nodes for inclusion in a result set. It is passed as an argument a TXPathExpression instance also created in the routine, and used to build the DOM tree that is the return value for the function. The evaluator is configured to perform a complete evaluation of the XPath expression, including phrases which are non-deterministic. It also returns the TXPathVariable instance with the DOM node(s) which match the evaluated expression. +
++ The TXPathVariable return value may be cast to a type expected in the application using methods like AsNodeSet, AsBoolean, or AsText. It may also be cast to a specific class type like TXPathNodeSetVariable, TXPathBooleanVariable, TXPathNumberVariable, or TXPathStringVariable. +
+