Class TXQueryEngine

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TXQueryEngine = class(TObject)

Description

This is the XPath/XQuery-engine

You can use this class to evaluate a XPath/XQuery-expression on a certain document tree.
For example, TXQueryEngine.evaluateStaticXPath2('expression', nil) returns the value of the evaluation of expression.

A simple functional interface is provided by the function query.

Syntax of a XQuery / XPath / Pseudo-XPath-Expression

This query engine currently supports XPath 2.0, XQuery 1.0 and JSONiq, with some extensions and minor deviations, as well as parts of XPath 3.0 and XQuery 3.0.

A formal syntax definition of these languages is given at: http://www.w3.org/TR/xpath20/ , http://www.w3.org/TR/xquery/ , http://www.jsoniq.org/ , http://www.w3.org/TR/xpath-30/ and http://www.w3.org/TR/xquery-30/ .

Some very basic, standard XPath examples, for people who have never seen XPath before:

  • "something" or "something"
    This returns the string 'something'.

  • $var
    This returns the value of the variable var.

  • a + b
    This returns the numerical sum of a and b
    Instead of +, you can also use one of operators -, *, div, idiv, =, !=, <, >, <=, =>, to, or, and, eq, ne, lt, gt, le, ge

  • 1245.567
    This returns the number 1245.567

  • concat("a","b","c")
    This concatenates the strings a,b and c.
    There are many more functions than concat, a list of extension functions is given below. Standard functions are described at http://www.w3.org/TR/xquery-operators/ and http://www.w3.org/TR/xpath-functions-30/

  • (1,2,3)
    This returns a sequence (1,2,3).
    Sequences cannot be nested.

  • (1,2,3)[. mod 2 = 1]
    This returns the sequence (1,3) of all odd numbers.

  • @attrib
    This is the value of the attribute attrib of the current tag

  • text()
    This returns a sequence of all direct text node children of the current tag (see below)

  • comment()
    This returns a sequence of all direct comment children of the current tag

  • xyz
    This returns a sequence of all direct children of the current tag whose node name is xyz

  • .//xyz
    This returns a sequence of all children of the current tag whose node name is xyz

  • abc/def
    This returns a sequence of all children of the current tag whose name is def and whose parent has the name abc and is a direct child of the current tag

  • abc//def
    This returns a sequence of all children of the current tag whose name is def and whose parent has the name abc

  • /html
    This returns a the html root tag

  • /html//text()
    This returns all text nodes in the current html document

  • /html//.[condition]/text()
    This returns all text nodes in the current html document whose parent satisfies condition

  • for $x in seq return $x + 1
    This adds 1 to all elements in the sequence seq

  • some $x in seq satisfies condition
    This returns true iff one element of seq satisfies condition

  • every $x in seq satisfies condition
    This returns true iff every element of seq satisfies condition

  • if (condition) then $x else $y
    This returns $x if condition is true, and $y otherwise

  • function ($a, $b) { $a + $b }
    This returns an anonymous function which adds two numbers.

Differences between this implementation and standard XPath/XQuery (most differences can be turned off with the respective option or the field in the default StaticContext):

Extended syntax:

  • x"something{$var}{1+2+3}..."
    If a string is prefixed with an x, all expressions within {..}-parenthesis are evaluated and concattenated to the raw text, similarily to the value of a xquery direct attribute constructor. (option: extended-strings)

  • var:=value
    This assigns the value value to the global variable var and returns value
    So you can e.g. write ((a := 2) + 3) and get 5 and a variable $a with the value 2
    $a := 2 is also allowed
    Can also be used to change object properties, array elements and sequences. $a("property")(1)("foo")[] := 17 appends 17 to {"property": [{"foo": THIS }]}. (but remember that everything is immutable! so it makes a copy, except objects which are shared)

  • All string comparisons are case insensitive, and "clever", e.g. '9xy' = '9XY' < '10XY' < 'xy',
    unless you use collations.

  • The default type system is weaker typed, most values are automatically converted if necessary, e.g. "1" + 2 returns 3.
    (option: strict-type-checking)

  • If a namespace prefix is unknown, the namespace is resolved using the current context item.
    This basically allows you to do namespace prefix only matching. (option: use-local-namespaces)

  • JSON-objects: JSON/JSONiq objects are supported. (option: json)
    Arrays can be created with [a,b,c]
    Like a sequence they store a list of values, but they can be nested with each other and within sequences.

    Object can be created with {"foobar": 123, "hallo": "world!", ...}
    They store a set of values as associative map. The values can be accessed similar to a function call, e.g.: {"name": value, ...}("name") as documented in the JSONiq extension standard.
    This implementation also provides an alternative property syntax, where these properties can be accessed with the usual OOP property dot syntax, i.e. {"name": 123}.name will evaluate to 123 (can be changed with the option property-dot-notation).
    If an object is assigned to a variable, you can append the dot to the variable name, e.g. let $obj := {"name": 123} return $obj.name. (drawback: variable names are not allowed to contains dots, if this extension is enabled. If set to "unambiguous", the dot operator can be used in cases where no confusion with variables with dots in their name can occur, e.g. ($a).b, $a .b or $a."b". )
    Objects are immutable, but the properties of objects that are global variables can seemingly be changed with $obj.property := newvalue. This creates a new object with name $obj that has all the properties of the old objects plus the changed properties.

    Objects can be assigned to each other (e.g. obj1 := {}, obj2 := {}, obj2.prop := 123, obj1.sub := obj2 ).
    Then obj1.sub.prop = 123, but changing obj1.sub.prop won't change obj2.prop (i.e. the objects are always copied, there are no pointers).
    An alternative, older object creation syntax is the object-function (see below).
    At default all values are allowed as object properties. If the option pure-json-objects is enabled, property values are converted to pure JSON types. (empty sequence => null, sequences => array, nodes => string)


    The additional module xquery_json implements all JSONiq functions, except JSONiq update and roundtrip-serialization.
    Using it also activates the JSONiq literal mode, in which true, false, null evaluate to true(), false(), jn:null(). (option: json-literals).

  • Element tests based on types of the xml are not supported (since it cannot read schemas )

  • Regex remarks (it might be changed to standard compatible matching in future):

    • The usual s/i/m/x-flags are allowed, and you can also use '-g' to disable greedy matching.

    • $0 and $& can be used as substitute for the whole regex, and $i or ${i} is substituted with the i-th submatch, for any integer i. Therefore $12 is match 12, while ${1}2 is match 1 followed by digit 2

  • Most of them can be disabled with 'declare option pxp:respective-option "off"' (that there are syntax modifying options is another extension)

New functions:

  • deep-text()
    This is the concatenated plain text of the every tag inside the current text. You can also pass a separator like deep-text(' ') to separate text of different nodes.

  • extract($string as xs:string, $regex as xs:string [, $match as xs:integer *,[$flags as xs:string]])
    This applies the regex $regex to $string and returns only the matching part.
    If the $match argument is provided, only the $match-th submatch will be returned. This can be a sequence of several integers.
    If flags contains *, all occurrences are returned
    (This functions used to be called filter, but was renamed to due to XQuery 3)

  • eval($query as xs:string)
    This evaluates $query as a XQuery-expression.

  • css($css as xs:string)
    This evaluates the $css string as a css selector.

  • parse-date($input as xs:string, $format as xs:string)
    Reads a date/time from string with the given format. $format is a standard Pascal format, using ymdhnsz (e.g. "yyyy-mm-dd"), not a XQuery 3.0 picture string.

  • parse-time(input as xs:string, $format as xs:string)
    Reads a date/time from string with the given format. $format is a standard Pascal format (see above)

  • parse-dateTime($input as xs:string, $format as xs:string)
    Reads a date/time from string with the given format. $format is a standard Pascal format (see above)

  • inner-xml($node as node())
    Returns the inner xml of a node as string (like innerHTML in javascript)

  • outer-xml($node as node())
    Returns the outer xml of a node as string (= inner-xml plus the opening/closing tag of the node itself)

  • inner-html($node as node())
    Returns the inner html of a node as string (like inner-xml, but valid html)

  • outer-html($node as node())
    Returns the outer html of a node as string (like outer-xml, but valid html)

  • form($form as node()*[, $override as item()*])
    This creates the request corresponding to a html form. The request includes the value of all input/select/textarea descendants of the $form parameter.
    You can use the $override parameter to give a sequence of values replacing the default values of the form elements.
    A value is either a string, e.g. "name=value&name2=..." which has to be url encoded and is splitted at the &-separators to override each parameter separately. (so the order of the name=value pairs is changed to the order of the input elements in the form)
    Or a JSON-like object {"name": "value", ...}, in which the properties must not be url encodeded (i.e. the form method url encodes each property) and in which each property overrides the corresponding parameter.

    It returns a JSON object with these properties:
    url: The url the form should be send to (includes the encoded data for a GET request)
    method: POST or GET
    post: Encoded post data
    headers: Sequence of additional headers

    Depending on the enctype attribute of the form, it will either return url encoded or multipart encoded post data. For latter, also a Content-Type header with the specific boundary is added.
    For multipart encoded data, the value parameters do not have to be strings, but can be JSON-objects. They can have these properties: "file": to upload a file. "value": for a string value. "filename": to set the filename field of the Content-Disposition header. "type": Becomes a Content-Type header. "headers": An arbitrary sequence of headers

  • resolve-html($relative as item()*, [$base as item()])
    Resolves every value in the $relative sequence to an HTTP request with an absolute URL/URI, using $base as reference base URI.
    Atomic values (e.g. strings) are resolved as simple URIs similar to resolve-uri.
    For HTML elements that refer to other resources (e.g. <a href=...> or <img src=...>) it returns the absolute URI of that resource. For <form> elements it returns the same object as the form function. For all other HTML elements it interprets the text content as relative string URI.
    If $base is not a node it treated as simple absolute URI. If $base is a node, the function uses the base URI of the document that contains the node.

  • uri-encode($uri-part as xs:string?)
    Encodes a string for a URI. Exactly the same as fn:encode-for-uri but with a simpler name.

  • uri-decode($uri-part as xs:string?)
    Decodes an URI string. The reverse of uri-encode (but no roundtrip guarantee)

  • is-nth($i as xs:integer, $a as xs:integer, $b as xs:integer)
    Returns true iff the equation i = a * n + b can be solved by an non-negative integer n. (This is used to implement the css functions like nth-child )

  • var := object()
    This creates an object with name $var. Default values can be passed as sequence of name/value pairs.
    A alternative syntax is {}

  • get-property($obj as object(), $name as xs:string)
    Returns the property with the given name of an object. Since this is just a normal function, it can also be used, if the object.property syntax has been disabled
    Deprecated, now the JSONiq syntax $obj($name) should be used. This function will be removed in later versions.

  • join($sequence as xs:item()*[, $seperator as xs:string])
    This is the same as string-join, but without type checking. If seperator is omitted it becomes " ".

  • transform([$root as item()*,] $f as function(), [$options as object()]]) as item()*
    Transform calls $f for every descendant and attribute node of $root and replaces each node with the return value of $f.
    If $root is omitted, the context item . is used.
    If $options("always-recurse") is true, all values returned by $f are also transformed with further calls of $f.
    Preliminary, behaviour might change in future versions. E.g. it might be renamed to map-nodes

  • match($template as item(), $node as node()+)
    Performs pattern matching between the template and the nodes, and returns a list or an object of matched values.

    E.g. match(<a>{{.}}</a>, <x><a>FOO</a><a>BAR</a></x>) returns <a>FOO</a>, and match(<a>*{{.}}</a>, <x><a>FOO</a><a>BAR</a></x>) returns (<a>FOO</a>, <a>BAR</a>)
    It is also possible to use named variables in the template, in which case an object is returned, e.g: match(<x><a>{{first:=.}}</a><a>{{second:=.}}</a></x>, <x><a>FOO</a><a>BAR</a></x>) returns an object with two properties first and bar, containing <a>FOO</a> and <a>BAR</a> respectively. These properties can be accessed like match(<x><a>{{first:=.}}</a><a>{{second:=.}}</a></x>, <x><a>FOO</a><a>BAR</a></x>).first
    Multiple values assigned to the same variable are merged into a single sequence, e.g. match(<x><a>{{res:=.}}</a><a>{{res:=.}}</a></x>, <x><a>FOO</a><a>BAR</a></x>) returns an object with a single property res with value (<a>FOO</a>, <a>BAR</a>)
    If unnamed and named variables are mixed, the unnamed variables are treated like variables with the name _result.
    The template can be a node or a string. Written as string the example above would be match("<a>{.}</a>", <x><a>FOO</a><a>BAR</a></x>).
    You can pass multiple templates and nodes, in which case each template is applied to each node, and the result of all matching calls is returned in a single sequence.
    If the template cannot be matched, an error is raised.
    see THtmlTemplateParser for the full template reference. (This function is not actually declared in xquery.pas, but in extendedhtmlparser.pas, so it is only available if latter unit is included in any uses clause. )

  • json($source as xs:string)
    Reads a json object/value from a string and converts it to an object/value (see object extension above).
    If the string is an url the json is loaded from there (i.e. be aware of possible security issues when using it. jn:parse-json from xquery_json / JSONiq will only parse it)
    Only available if the xquery_json unit is included in an uses clause.

  • serialize-json($object as item()* )
    Serializes an xq value as JSON string.
    Only available if the xquery_json unit is included in an uses clause.

  • binary-to-string($data as xs:base64Binary|xs:hexBinary[, $encoding as xs:string]) as xs:string
    Converts $data to a string using the given $encoding

  • string-to-hexBinary($data as xs:string[, $encoding as xs:string]) as xs:hexBinary
    Returns a hex binary representation of $data with the given $encoding

  • string-to-base64Binary($data as xs:string[, $encoding as xs:string]) as xs:base64Binary
    Returns a base64 binary representation of $data with the given $encoding

  • random([$max])
    Returns a random number

  • random-seed([$seed])
    Initializes the random number generator

  • All above functions belong to the namespace "http://www.benibela.de/2012/pxp/extensions", which is at default bound to the prefixes "pxp" and "". This namespace also contains a copy of all standard XPath function

You can look at the unit tests in the tests directory to see many (> 5000) examples.

Using the class in FPC

The simplest way to use it with the function query and the defaultQueryEngine.

You can evaluate XQuery/XPath-expressions by calling the class methods, e.g. TXQueryEngine.evaluateStaticXPath3('expression', nil) or TXQueryEngine.evaluateStaticXPath2('expression', nil).toInt64 which returns the value of the expression, converted to the corresponding type.
If you want to process a html/xml document, you have to pass the root TTreeNode (obtained by TTreeParser) instead of nil.


If you call TXQueryEngine.evaluateStaticXPath3('expression', nil) without a following toType-call, you obtain the result as an IXQValue. (see IXQValue on how to use it)
With a toType-call it is converted in the corresponding type, e.g. toInt64 returns a int64, toString a string, toNode a TTreeNode or toFloat an extended.

You can also create a TXQueryEngine instance and then call parseXPath2('expression') and evaluateXPath2().
This is not as easy, but you have more options.

The unit simpleinternet provided a simpler procedural interface which is now deprecated.



Compatibility to previous version
The following major breaking changes occured to make it more standard compatible:

  • Language changes:

    • Function and type names are now case sensitive.

    • The function pxp:filter has been removed to avoid confusion with the function fn:filter. (The replacement pxp:extract has existed for years)

    • Declarations in XQuery need to be separated by ; and conflicting declarations or non-module queries containing only declarations are forbidden

    • Variables are no longer replaced inside "-strings. Instead x"-strings were added. All old uses of "$var;" therefore have to be replaced by x"{$var}"

    • All string comparisons are now (non-localized ascii) case-insensitive, not only equal comparisons (as always mentioned in the documentation)

    • Variables defined by a PXPath expression inside an PXPath eval call are exported to the outside

    • == is no longer allowed as alias to =

    • the function deepNodeText is now called deep-text

    • regex flag s defaults to off

  • API changes to previous versions:

    • IXQValue.getChild was renamed to get, TXQValueSequence.addChild to add and addChildMerging to addOrdered. "child" never made any sense here

    • ParentElement/RootElement/TextElement have been moved from TXQueryEngine to TXQEvaluationContext. Avoid using them, just pass the element to evaluate.

    • Callbacks for external variables/functions have been changed to ask for a namespace URI instead a namespace object with URI/prefix (for 3's EQNames which do not have a prefix)

    • Parsing modifying properties Allow* are now moved in a ParsingOptions record. It was becoming too confusing

    • everything has been renamed, pseudoxpath.pas => xquery.pas, TPseudoXPathParser => TXQueryEngine, TPXPValue => IXQValue

    • The TPXPValue class has been replaced by an interface => memory deallocation has become implicit and .free must not be called.
      => functions like toString and asString become identically and latter has been removed. Similarly functions like getValueAsString() are not needed anymore and have been removed as well

    • TPXPValue is now a class with subclasses instead of a case record

    • Some things have been renamed, the new names should be obvious

    • The evaluate functions return now a TPXPValue instead of a string, since they may return a typed value or sequence.

Hierarchy

  • TObject
  • TXQueryEngine

Overview

Fields

Public CurrentDateTime: TDateTime;
Public ImplicitTimezoneInMinutes: Integer;
Public StaticContext: TXQStaticContext;
Public VariableChangelog: TXQVariableChangeLog;
Public OnDeclareExternalVariable: TXQDeclareExternalVariableEvent;
Public OnDeclareExternalFunction: TXQDeclareExternalFunctionEvent;
Public OnImportModule: TXQImportModuleEvent;
Public OnTrace: TXQTraceEvent;
Public OnCollection: TXQEvaluateVariableEvent;
Public OnUriCollection: TXQEvaluateVariableEvent;
Public OnParseDoc: TXQParseDocEvent;
Public ParsingOptions: TXQParsingOptions;
Public GlobalNamespaces: TNamespaceList;
Public AutomaticallyRegisterParsedModules: boolean;
Public DefaultParser: TTreeParser;

Methods

Public procedure clear;
Public function parseXPath2(s:string; sharedContext: TXQStaticContext = nil): IXQuery;
Public function parseXQuery1(s:string; sharedContext: TXQStaticContext = nil): IXQuery;
Public function parseXPath3(s:string; sharedContext: TXQStaticContext = nil): IXQuery;
Public function parseXQuery3(s:string; sharedContext: TXQStaticContext = nil): IXQuery;
Public function parseCSS3(s:string): IXQuery;
Public function parseQuery(s:string; model: TXQParsingModel; sharedContext: TXQStaticContext = nil): IXQuery;
Public function evaluate(const context: TXQEvaluationContext): IXQValue;
Public function evaluate(const contextItem: IXQValue): IXQValue;
Public function evaluate(tree:TTreeNode = nil): IXQValue;
Public constructor create;
Public destructor Destroy; override;
Public function evaluateXPath2(expression: string; tree:TTreeNode = nil): IXQValue;
Public function evaluateXPath2(expression: string; const contextItem: IXQValue): IXQValue;
Public function evaluateXQuery1(expression: string; tree:TTreeNode = nil): IXQValue;
Public function evaluateXQuery1(expression: string; const contextItem: IXQValue): IXQValue;
Public function evaluateXPath3(expression: string; tree:TTreeNode = nil): IXQValue;
Public function evaluateXPath3(expression: string; const contextItem: IXQValue): IXQValue;
Public function evaluateXQuery3(expression: string; tree:TTreeNode = nil): IXQValue;
Public function evaluateXQuery3(expression: string; const contextItem: IXQValue): IXQValue;
Public function evaluateCSS3(expression: string; tree:TTreeNode = nil): IXQValue;
Public function evaluateCSS3(expression: string; const contextItem: IXQValue): IXQValue;
Public class function evaluateStaticXPath2(expression: string; tree:TTreeNode = nil): IXQValue;
Public class function evaluateStaticXPath2(expression: string; const contextItem: IXQValue): IXQValue;
Public class function evaluateStaticXPath3(expression: string; tree:TTreeNode = nil): IXQValue;
Public class function evaluateStaticXPath3(expression: string; const contextItem: IXQValue): IXQValue;
Public class function evaluateStaticXQuery1(expression: string; tree:TTreeNode = nil): IXQValue;
Public class function evaluateStaticXQuery1(expression: string; const contextItem: IXQValue): IXQValue;
Public class function evaluateStaticXQuery3(expression: string; tree:TTreeNode = nil): IXQValue;
Public class function evaluateStaticXQuery3(expression: string; const contextItem: IXQValue): IXQValue;
Public class function evaluateStaticCSS3(expression: string; tree:TTreeNode = nil): IXQValue;
Public procedure registerModule(module: IXQuery);
Public function findModule(const namespaceURL: string): TXQuery;
Public class function findNativeModule(const ns: string): TXQNativeModule;
Public class procedure registerCollation(const collation: TXQCollation);
Public class function getCollation(id:string; base: string; errCode: string = 'FOCH0002'): TXQCollation;
Public class procedure registerNativeModule(const module: TXQNativeModule);
Public class function collationsInternal: TStringList;
Public function getEvaluationContext(staticContextOverride: TXQStaticContext = nil): TXQEvaluationContext;
Public function findNamespace(const nsprefix: string): INamespace;
Public class function findOperator(const pos: pchar): TXQOperatorInfo;

Properties

Public property ExternalDocumentsCacheInternal: TStringList read FExternalDocuments write FExternalDocuments;
Public property LastQuery: IXQuery read FLastQuery;

Description

Fields

Public CurrentDateTime: TDateTime;

Current time

Public ImplicitTimezoneInMinutes: Integer;

Local timezone (high(integer) = unknown, 0 = utc).

Public StaticContext: TXQStaticContext;

XQuery static context, defining various default values.

Public VariableChangelog: TXQVariableChangeLog;

All global variables that have been set (if a variable was overriden, it stores the old and new value)

Public OnDeclareExternalVariable: TXQDeclareExternalVariableEvent;
 
Public OnDeclareExternalFunction: TXQDeclareExternalFunctionEvent;

Event called to import a function that is declared as "declare function ... external" in a XQuery expression.

Public OnImportModule: TXQImportModuleEvent;

Event called to import a XQuery module that has not previously be defined

Public OnTrace: TXQTraceEvent;

Event called by fn:trace

Public OnCollection: TXQEvaluateVariableEvent;

Event called by fn:collection

Public OnUriCollection: TXQEvaluateVariableEvent;

Event called by fn:collection

Public OnParseDoc: TXQParseDocEvent;

Event called by fn:doc (if nil, a default xml parser is used)

Public ParsingOptions: TXQParsingOptions;
 
Public GlobalNamespaces: TNamespaceList;

Globally defined namespaces

Public AutomaticallyRegisterParsedModules: boolean;
 
Public DefaultParser: TTreeParser;
 

Methods

Public procedure clear;

Clears all data.

Public function parseXPath2(s:string; sharedContext: TXQStaticContext = nil): IXQuery;

Parses a new XPath 2.0 expression and stores it in tokenized form.

Public function parseXQuery1(s:string; sharedContext: TXQStaticContext = nil): IXQuery;

Parses a new XQuery 1.0 expression and stores it in tokenized form.

Public function parseXPath3(s:string; sharedContext: TXQStaticContext = nil): IXQuery;

Parses a new XPath 3.0 expression and stores it in tokenized form. Work in progress, only a small set of 3.0 statements is supported

Public function parseXQuery3(s:string; sharedContext: TXQStaticContext = nil): IXQuery;

Parses a new XQuery 3.0 expression and stores it in tokenized form. Work in progress, only a small set of 3.0 statements is supported

Public function parseCSS3(s:string): IXQuery;

Parses a new CSS 3.0 Selector expression and stores it in tokenized form.

Public function parseQuery(s:string; model: TXQParsingModel; sharedContext: TXQStaticContext = nil): IXQuery;

Parses a new expression and stores it in tokenized form.

Public function evaluate(const context: TXQEvaluationContext): IXQValue;
 
Public function evaluate(const contextItem: IXQValue): IXQValue;

Evaluates a previously parsed query and returns its value as IXQValue

Public function evaluate(tree:TTreeNode = nil): IXQValue;

Evaluates a previously parsed query and returns its value as IXQValue

Public constructor create;
 
Public destructor Destroy; override;
 
Public function evaluateXPath2(expression: string; tree:TTreeNode = nil): IXQValue;

Evaluates an XPath 2.0 expression with a certain tree element as current node.

Public function evaluateXPath2(expression: string; const contextItem: IXQValue): IXQValue;
 
Public function evaluateXQuery1(expression: string; tree:TTreeNode = nil): IXQValue;

Evaluates an XQuery 1.0 expression with a certain tree element as current node.

Public function evaluateXQuery1(expression: string; const contextItem: IXQValue): IXQValue;
 
Public function evaluateXPath3(expression: string; tree:TTreeNode = nil): IXQValue;

Evaluates an XPath 3.0 expression with a certain tree element as current node. Work in progress, only a small set of 3.0 statements is supported

Public function evaluateXPath3(expression: string; const contextItem: IXQValue): IXQValue;
 
Public function evaluateXQuery3(expression: string; tree:TTreeNode = nil): IXQValue;

Evaluates an XQuery 3.0 expression with a certain tree element as current node. Work in progress, only a small set of 3.0 statements is supported

Public function evaluateXQuery3(expression: string; const contextItem: IXQValue): IXQValue;
 
Public function evaluateCSS3(expression: string; tree:TTreeNode = nil): IXQValue;

Evaluates an CSS 3 Selector expression with a certain tree element as current node.

Public function evaluateCSS3(expression: string; const contextItem: IXQValue): IXQValue;
 
Public class function evaluateStaticXPath2(expression: string; tree:TTreeNode = nil): IXQValue;

Evaluates an expression with a certain tree element as current node.

Public class function evaluateStaticXPath2(expression: string; const contextItem: IXQValue): IXQValue;
 
Public class function evaluateStaticXPath3(expression: string; tree:TTreeNode = nil): IXQValue;
 
Public class function evaluateStaticXPath3(expression: string; const contextItem: IXQValue): IXQValue;
 
Public class function evaluateStaticXQuery1(expression: string; tree:TTreeNode = nil): IXQValue;
 
Public class function evaluateStaticXQuery1(expression: string; const contextItem: IXQValue): IXQValue;
 
Public class function evaluateStaticXQuery3(expression: string; tree:TTreeNode = nil): IXQValue;
 
Public class function evaluateStaticXQuery3(expression: string; const contextItem: IXQValue): IXQValue;
 
Public class function evaluateStaticCSS3(expression: string; tree:TTreeNode = nil): IXQValue;

Evaluates an expression with a certain tree element as current node.

Public procedure registerModule(module: IXQuery);

Registers an XQuery module. A XQuery module is created by parsing (not evaluating) a XQuery expression that contains a "module" declaration

Public function findModule(const namespaceURL: string): TXQuery;

Finds a certain registered XQuery module

Public class function findNativeModule(const ns: string): TXQNativeModule;

Finds a native module.

Public class procedure registerCollation(const collation: TXQCollation);

Registers a collation for custom string comparisons

Public class function getCollation(id:string; base: string; errCode: string = 'FOCH0002'): TXQCollation;

Returns the collation for an url id

Public class procedure registerNativeModule(const module: TXQNativeModule);
 
Public class function collationsInternal: TStringList;
 
Public function getEvaluationContext(staticContextOverride: TXQStaticContext = nil): TXQEvaluationContext;
 
Public function findNamespace(const nsprefix: string): INamespace;
 
Public class function findOperator(const pos: pchar): TXQOperatorInfo;
 

Properties

Public property ExternalDocumentsCacheInternal: TStringList read FExternalDocuments write FExternalDocuments;
 
Public property LastQuery: IXQuery read FLastQuery;

Last parsed query


Generated by PasDoc 0.14.0.