Unit xquery

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

This unit contains a modern XPath / XQuery interpreter

The most important class is TXQueryEngine, which implements the interpreter, and IXQValue, which is the variant used to store the results.

The simplest way to evaluate an expression is to use the global function query.

For example, if you want to find all links on a webpage, you can do one of the following:

query('doc("http://example.org")//a')

query('"http://example.org"').retrieve().map('//a')

xqvalue('http://example.org').retrieve().map('//a')

query('doc($_1)//a', ['http://example.org'])

The first example is the simplest, the third demonstrates the functional interface of IXQValue, and the last how to use variables with query.

Overview

Classes, Interfaces, Objects and Records

Name Description
record float  
record TXQValueEnumeratorPtrUnsafe Iterator over PIXQValue.
record TXQValueEnumerator Iterator over an IXQValue.
Class TXQStaticContext  
record TXQEvaluationContext evaluation context, internal used
record TXQValueDateTimeData  
Interface IXQValue Variant used in XQuery-expressions
Class TXQValue  
Class TXQValueUndefined  
Class TXQValueBoolean  
Class TXQValueInt64  
Class TXQValueFloat  
Class TXQValueDecimal  
Class TXQValueString  
Class TXQValueQName  
Class TXQValueDateTime  
Class TXQValueSequence  
Class TXQValueJSONIQStructuredItem  
Class TXQValueNode  
Class TXQPropertyEnumeratorInternal  
Class TXQProperty  
Class TXQValuePropertyEnumerator  
Class TXQValueJSONIQItem  
Class TXQValueObject  
Class TXQValueJSONArray  
Class TXQValueJSONNull  
record TXQFunctionParameter  
Class TXQEQName  
Class TXQEQNameWithPrefix  
record TXQAnnotation  
Class TXQValueFunction  
Class TXSAnnotation  
Class TXSConstrainingFacet  
Class TXSConstrainingFacetOrdinal  
Class TXSConstrainingFacetValue  
Class TXSConstrainingFacetObject  
Class TXSType  
Class TXSSimpleType  
Class TXSUnionType  
Class TXSListType  
Class TXSNumericType  
Class TXSBooleanType  
Class TXSStringType  
Class TXSQNameType  
Class TXSDateTimeType  
Class TXQMapStringObject  
Class TXSSchema  
Class TJSONiqOverrideSchema  
Class TJSONiqAdditionSchema  
Class TXQVCustomList List of TXQValue-s
Class TXQVList List of TXQValue-s
Class TXQEvaluationStack  
record TXQFunctionParameterTypes  
Class TXQAbstractFunctionInfo  
Class TXQBasicFunctionInfo  
Class TXQComplexFunctionInfo  
Class TXQInterpretedFunctionInfo  
Class TXQOperatorInfo  
record TXQPathMatchingStepFilter  
record TXQPathMatchingStep Step of a query in a tree
record TXQPathNodeCondition  
Class TXQTerm_Visitor  
Class TXQTerm Internally used xpath term
Class TXQTermWithChildren  
Class TXQTermWithChildrenOnStack  
Class TXQTermConstant  
Class TXQTermSequence  
Class TXQTermJSONArray  
Class TXQTermSequenceType  
Class TXQTermEQNameToken  
Class TXQTermVariable  
Class TXQTermVariableGlobal  
Class TXQTermVariableGlobalImported  
Class TXQTermDefineVariable  
Class TXQTermDefineFunction  
Class TXQTermPlaceholderVariable  
Class TXQTermContextItem  
Class TXQTermNodeMatcher  
Class TXQTermFilterSequence  
Class TXQTermPatternMatcher  
Class TXQTermNamedFunction  
Class TXQTermNamedFunctionTypeConstructor  
Class TXQTermDynamicFunctionCall  
Class TXQTermBinaryOp  
Class TXQTermSimpleMap  
Class TXQTermPath  
Class TXQTermFlowerSubClause  
Class TXQTermFlowerLet  
Class TXQTermFlowerFor  
record TXQTermFlowerWindowVarsAndCondition  
Class TXQTermFlowerWindow  
Class TXQTermFlowerLetPattern  
Class TXQTermFlowerForPattern  
Class TXQTermFlowerWhere  
Class TXQTermFlowerOrder  
Class TXQTermFlowerCount  
Class TXQTermFlowerGroup  
Class TXQTermFlower  
Class TXQTermSomeEvery  
Class TXQTermIf  
Class TXQTermTypeSwitch  
Class TXQTermSwitch  
Class TXQTermReadObjectProperty  
Class TXQTermConstructor  
Class TXQTermConstructorComputed  
Class TXQTermJSONObjectConstructor  
Class TXQTermTryCatch  
Class TXQTermModule  
Interface IXQuery Interface for an XPath/XQuery query.
Class TXQuery  
Class EXQException  
Class EXQParsingException  
Class EXQEvaluationException  
record TXQParsingOptions  
Class TXQueryEngine This is the XPath/XQuery-engine
record TXQVariable A XQuery variable
Class TXQVariableChangeLog XQuery variable storage
Class TXQCollation  
Class TXQCollationCodepoint  
Class TXQCollationCodepointClever  
Class TXQCollationCodepointInsensitive  
Class TXQCollationCodepointInsensitiveClever  
Class TXQCollationCodepointLocalized  
Class TXQCollationCodepointLocalizedInsensitive  
record TXQDecimalFormatPropertyData  
Class TXQDecimalFormat  
Class TXQValue_DatePart  
Class TXQNativeModule  
Class TXQAbstractParsingContext  
Class TXQTerm_VisitorTrackKnownVariables  

Functions and Procedures

function xqvalue():IXQValue;
function xqvalue(const v: Boolean):IXQValue; inline;
function xqvalueTrue:IXQValue; inline;
function xqvalueFalse:IXQValue; inline;
function xqvalue(const v: Int64):IXQValue; inline;
function xqvalue(v: Integer):IXQValue; inline;
function xqvalue(v: xqfloat):IXQValue; inline;
function xqvalue(const v: BigDecimal):IXQValue; inline;
function xqvalue(const v: string):IXQValue; inline;
function xqvalue(intentionallyUnusedParameter: TDateTime):IXQValue; inline;
function xqvalue(v: TTreeNode):IXQValue; inline;
function xqvalue(sl: TStringList): IXQValue;
function xqvalue(const sl: array of string): IXQValue;
function xqvalue(const sl: array of IXQValue): IXQValue;
procedure xqvalueSeqSqueeze(var v: IXQValue);
procedure xqvalueSeqSqueezed(out result: IXQValue; l: TXQVList);
procedure xqvalueSeqConstruct(var result: IXQValue; var seq: TXQValueSequence; const add: IXQValue);
function xqvalueArray(a: array of IXQValue): TXQVArray;
procedure xqvalueMoveNoRefCount(const source: IXQValue; var dest: IXQValue ); inline;
procedure xqvalueVaporize(var dest: IXQValue); inline;
function jsonStrEscape(s: string):string;
procedure requiredArgCount(argc: sizeint; minc: sizeint; maxc: sizeint = -2);
procedure requiredArgType(const v: IXQValue; typ: TXSType);
function xqfloatRounded(f: xqfloat; prec: integer = 0): xqfloat;
procedure xpathRangeDefinition(argc: sizeint; args: PIXQValue; const maxLen: longint; out from, len: integer);
function xqvalueAtomize(const v: IXQValue): IXQValue;
function xqvalueDeep_equal(const context: TXQEvaluationContext; const a, b: IXQValue; collation: TXQCollation): boolean;
function query(q: string): IXQValue; overload;
function query(q: string; const vs: array of ixqvalue): IXQValue; overload;
function query(q: string; const vs: array of string): IXQValue; overload;
function defaultQueryEngine: TXQueryEngine;
procedure freeThreadVars;
function xqFunctionConcat(argc: SizeInt; args: PIXQValue): IXQValue;
function xqgetTypeInfo(wrapper: Ixqvalue): TXQTermSequenceType;
function xqvalueCastAs(const cxt: TXQEvaluationContext; const ta, tb: IXQValue): IXQValue;
function xqvalueCastableAs(const cxt: TXQEvaluationContext; const ta, tb: IXQValue): IXQValue;
function xqvalueInstanceOf(const cxt: TXQEvaluationContext; const ta, tb: IXQValue): IXQValue;
function xqvalueOrPlaceholder(const cxt: TXQEvaluationContext; const a, b: IXQValue): IXQValue;
function xqvalueAndPlaceholder(const cxt: TXQEvaluationContext; const a, b: IXQValue): IXQValue;
procedure freeAnnotations(annotations: TXQAnnotations);
function charUnicodeZero(const cp: integer): integer;
procedure ignore(const intentionallyUnusedParameter: TXQEvaluationContext); inline;
procedure ignore(const intentionallyUnusedParameter: IXQValue); inline;
procedure ignore(const intentionallyUnusedParameter: TObject); inline;
procedure ignore(const intentionallyUnusedParameter: TXQVArray); inline;
function getNaN: xqfloat;
function getPosInf: xqfloat;
function getNegInf: xqfloat;
function isPosInf(const f: xqfloat): boolean;
function isNegInf(const f: xqfloat): boolean;
function isSignedXQFloat(const v: xqfloat): boolean;
function treeElementAsString(node: TTreeNode; deepSeparator: string = ''): string; inline; deprecated 'for internal use';
function urlHexDecode(s: string): string; deprecated 'for internal use';
procedure raiseFORG0001InvalidConversion(const v: IXQValue; const convTo: string);
procedure raiseXPTY0004TypeError(const v: IXQValue; const convTo: string);
procedure raiseFOTY0013TypeError(const v: IXQValue);
procedure raiseXQEvaluationError(const code, s: string; const data: IXQValue);

Types

PXQValue = ˆTXQValue;
PIXQValue = ˆIXQValue;
TXQVArray = array of IXQValue;
TXQTermArray = array of TXQTerm;
xqfloat = double;
TXQValueKind = (...);
TXQTermFlowerOrderEmpty = (...);
TXQDefaultNamespaceKind = (...);
TXQPropertyDotNotation = (...);
TTreeNodeSerialization = (...);
TXQParsingModel = (...);
PXQEvaluationContext = ˆTXQEvaluationContext;
TXQValueClass = class of TXQValue;
PXQValueDateTimeData = ˆTXQValueDateTimeData;
TXQValueInt64Class = class of TXQValueInt64;
TXQValueFloatClass = class of TXQValueFloat;
TXQValueDecimalClass = class of TXQValueDecimal;
TXQValueDateTimeClass = class of TXQValueDateTime;
TXQAnnotations = array of TXQAnnotation;
TXSConstrainingFacetKind = (...);
TXSConstrainingFacetWhitespace = (...);
TXSConstrainingFacetExplicitTimeZone = (...);
TXSCastingError = (...);
TXSNumericSubType = (...);
TXSStringSubType = (...);
TXQDateTimeTruncation = (...);
TXSSchemaVersion = (...);
TXQBasicFunction = function (argc: SizeInt; argv: PIXQValue): IXQValue;
TXQComplexFunction = function (const context: TXQEvaluationContext; argc: SizeInt; argv: PIXQValue): IXQValue;
TXQBinaryOp = function (const cxt: TXQEvaluationContext; const a,b: IXQValue): IXQValue;
PXQFunctionParameterTypes = ˆTXQFunctionParameterTypes;
TXQContextDependency = (...);
TXQContextDependencies = set of TXQContextDependency;
TXQOperatorFlags = set of (xqofAssociativeSyntax, xqofCastUntypedToString, xqofCastUntypedToDouble);
TXQPathMatchingAxis = (...);
TXQPathMatchingKind = (...);
TXQPathMatchingKinds = set of TXQPathMatchingKind;
TXQPathMatchingStepFilters = array of TXQPathMatchingStepFilter;
TXQPathMatching = array of TXQPathMatchingStep;
TTreeElementTypes = set of TTreeNodeType;
TXQPathNodeConditionIteration = (...);
TXQPathNodeConditionOption = (...);
TXQPathNodeConditionOptions = set of TXQPathNodeConditionOption;
PXQTerm = ˆTXQTerm;
PXQTermVariable = ˆTXQTermVariable;
TXQTerm_VisitAction = (...);
TXQTerm_VisitorClass = class of TXQTerm_Visitor;
TXQTermClass = class of TXQTerm;
TXQTypeInformationKind = (...);
TXQNamespaceMode = (...);
TXQTermDefineFunctionKind = (...);
TXQTermNodeMatcherDirect = (...);
TXQTermNamedFunctionKind = (...);
TXQTermFlowerSubClauseKind = (...);
TXQTermFlowerWindowFlags = set of (xqtfwSliding , xqtfwEndOnlyWhen);
TXQTermFlowerWindowVariableCallback = procedure (data: pointer; v: TXQTermVariable);
TXQInternalPatternMatcherParse = function (const context: TXQStaticContext; data: string): TXQTermPatternMatcher;
TXQInternalPatternMatcherMatch = function (template, data: TTreeNode; var context: TXQEvaluationContext; throwExceptions: boolean = false): TXQVariableChangeLog;
TXQInternalPatternMatcherVisit = function (const template: TXQTermPatternMatcher; visitor: TXQTerm_Visitor): TXQTerm_VisitAction;
TXQExceptionEvent = procedure (exception: EXQException) of object;
TXQEvaluateVariableEvent = function (sender: TObject; const variable: string; var value: IXQValue): boolean of object;
TXQDeclareExternalVariableEvent = procedure(sender: TObject; const context: TXQStaticContext; const namespaceUrl, variable: string; var value: IXQValue) of object;
TXQDeclareExternalFunctionEvent = procedure(sender: TObject; const context: TXQStaticContext; const namespaceURL, functionName: string; var result: TXQValueFunction) of object;
TXQImportModuleEvent = procedure (sender: TObject; const namespace: string; const at: array of string) of object;
TXQTraceEvent = procedure (sender: TXQueryEngine; value, info: IXQValue) of object;
TXQParseDocEvent = procedure (sender: TXQueryEngine; data, url, contenttype: string; var node: TTreeNode) of object;
TXQFormatIntegerModifier = (...);
TXQFormatIntegerModifiers = set of TXQFormatIntegerModifier;
TXQFormatIntegerEvent = procedure (sender: TObject; integerNumber: BigDecimal; primaryFormat, modifierVariant, language: string; modifiers: TXQFormatIntegerModifiers; var formatted: string) of object;
TXQDecimalFormatProperty = (...);
TXQDebugTracingEvent = procedure (term: TXQTerm; const context: TXQEvaluationContext; argc: SizeInt; args: PIXQValue) of object;

Constants

MY_NAMESPACE_PREFIX_URL = 'http://www.benibela.de/2012/pxp/';
XMLNamespaceURL_XPathFunctions = 'http://www.w3.org/2005/xpath-functions';
XMLNamespaceURL_XPathFunctionsMath = 'http://www.w3.org/2005/xpath-functions/math';
XMLNamespaceURL_XMLSchema = 'http://www.w3.org/2001/XMLSchema';
XMLNamespaceURL_XMLSchemaInstance = 'http://www.w3.org/2001/XMLSchema-instance';
XMLNamespaceURL_XQueryLocalFunctions = 'http://www.w3.org/2005/xquery-local-functions';
XMLNamespaceURL_XQTErrors = 'http://www.w3.org/2005/xqt-errors';
XMLNamespaceURL_MyExtensionsMerged = MY_NAMESPACE_PREFIX_URL + 'extensions';
XMLNamespaceURL_MyExtensionsNew = 'http://pxp.benibela.de';
XMLNamespaceURL_MyExtensionOperators = MY_NAMESPACE_PREFIX_URL + 'operators';
XMLNamespaceURL_XQuery = 'http://www.w3.org/2012/xquery';
MicroSecsPerSec = int64(1000000);
MATCH_ALL_NODES = [qmText,qmComment,qmElement,qmProcessingInstruction,qmAttribute,qmDocument];

Variables

XQGlobalTrimNodes: boolean = true;
XQGlobalUseIDfromDTD: boolean = false;
XQOnGlobalDebugTracing: TXQDebugTracingEvent;
GlobalStaticNamespaces: TNamespaceList;
AllowJSONDefaultInternal: boolean = false;
baseSchema: TJSONiqOverrideSchema;
baseJSONiqSchema: TJSONiqAdditionSchema;
patternMatcherParse: TXQInternalPatternMatcherParse;
patternMatcherMatch: TXQInternalPatternMatcherMatch;
patternMatcherVisit: TXQInternalPatternMatcherVisit;
resolveHTMLCallback: TXQComplexFunction;
XMLNamespace_XPathFunctions: INamespace;
XMLNamespace_MyExtensionsNew: INamespace;
XMLNamespace_MyExtensionsMerged: INamespace;
XMLNamespace_MyExtensionOperators: INamespace;
XMLNamespace_XMLSchema: INamespace;
XQDefaultDecimalFormat: TXQDecimalFormatPropertyData = ( chars: (ord('.'), ord(','), ord('-'), ord('%'), $2030, ord('0'), ord('#'), ord(';'), ord('e') ); infinity: 'Infinity'; nan: 'NaN');

Description

Functions and Procedures

function xqvalue():IXQValue;

Creates an undefined/empty-sequence IXQValue

function xqvalue(const v: Boolean):IXQValue; inline;

Creates an boolean IXQValue

function xqvalueTrue:IXQValue; inline;

Creates an boolean IXQValue

function xqvalueFalse:IXQValue; inline;

Creates an boolean IXQValue

function xqvalue(const v: Int64):IXQValue; inline;

Creates an integer IXQValue

function xqvalue(v: Integer):IXQValue; inline;

Creates an integer IXQValue

function xqvalue(v: xqfloat):IXQValue; inline;

Creates an BigDecimal IXQValue

function xqvalue(const v: BigDecimal):IXQValue; inline;

Creates an BigDecimal IXQValue

function xqvalue(const v: string):IXQValue; inline;

Creates a string IXQValue

function xqvalue(intentionallyUnusedParameter: TDateTime):IXQValue; inline;

Raises an exception (to prevent xquery(TDateTime) from using xquery(float))

function xqvalue(v: TTreeNode):IXQValue; inline;

Creates a node TXQValue

function xqvalue(sl: TStringList): IXQValue;

Creates a sequence of strings (does *not* free the list)

function xqvalue(const sl: array of string): IXQValue;

Creates a sequence of untyped strings

function xqvalue(const sl: array of IXQValue): IXQValue;

Creates a sequence

procedure xqvalueSeqSqueeze(var v: IXQValue);

Squeezes an IXQValue (single element seq => single element, empty seq => undefined)

procedure xqvalueSeqSqueezed(out result: IXQValue; l: TXQVList);

Creates an IXQValue from a list sequence (assume it FREEs the list)

procedure xqvalueSeqConstruct(var result: IXQValue; var seq: TXQValueSequence; const add: IXQValue);

Adds a value to an implicit sequence list in result, i.e. you call it multiple times and the result becomes a sequence of all the add values.
For the first call result and seq must be nil.
The point is that it only creates a sequence if there are multiple values, and it is especially fast, if you do not expect multiple values.

function xqvalueArray(a: array of IXQValue): TXQVArray;
 
procedure xqvalueMoveNoRefCount(const source: IXQValue; var dest: IXQValue ); inline;

Assigns source to dest without updating ref counts
This can be much faster, but will cause a crash, unless the reference count is corrected later, e.g. by xqvalueVaporize on source or dest.

procedure xqvalueVaporize(var dest: IXQValue); inline;
 
function jsonStrEscape(s: string):string;

Returns a "..." string for use in json (internally used)

procedure requiredArgCount(argc: sizeint; minc: sizeint; maxc: sizeint = -2);

Escapes for an URL (internally used)

Checks the length of the args array (internally used)

procedure requiredArgType(const v: IXQValue; typ: TXSType);
 
function xqfloatRounded(f: xqfloat; prec: integer = 0): xqfloat;
 
procedure xpathRangeDefinition(argc: sizeint; args: PIXQValue; const maxLen: longint; out from, len: integer);

Calculates starting position / length from a range definition (checks for things like NaN, INF, ...) (internally used)

function xqvalueAtomize(const v: IXQValue): IXQValue;
 
function xqvalueDeep_equal(const context: TXQEvaluationContext; const a, b: IXQValue; collation: TXQCollation): boolean;
 
function query(q: string): IXQValue; overload;

Evaluates an XQuery 3 query using the defaultQueryEngine.

For example query('1 to 10') to get all numbers from 1 to 10. Or query('doc("http://example.org")//title') to get the title of a webpage.

function query(q: string; const vs: array of ixqvalue): IXQValue; overload;

Evaluates an XQuery 3 query using the defaultQueryEngine. All values in vs are available as $_1, $_2, $_3, ...

function query(q: string; const vs: array of string): IXQValue; overload;

Evaluates an XQuery 3 query using the defaultQueryEngine. All values in vs are available as $_1, $_2, $_3, ...

For example query('$_1 to $_2', ['10', '100']) to get all numbers from 10 to 100.
Or query('doc($_1)//title', ['http://example.org']) to get the title of a webpage.
Or query('form(doc($_1)//form, {"q": $_2})', ['http://google.com', 'search term']).retrieve() to fill in a formular on a webpage/search something on Google.

function defaultQueryEngine: TXQueryEngine;

This is a thread local global query engine. You must call freeThreadVars, after having using it from different threads. When loading additional XML/HTML documents (e.g. with doc or retrieve) they are also only freed by freeThreadVars.

procedure freeThreadVars;

If you use the default query engine from different threads, you have to call freeThreadVars. before the thread terminates to prevent memory leaks
This also calls freeThreadVars of internetaccess

function xqFunctionConcat(argc: SizeInt; args: PIXQValue): IXQValue;
 
function xqgetTypeInfo(wrapper: Ixqvalue): TXQTermSequenceType;
 
function xqvalueCastAs(const cxt: TXQEvaluationContext; const ta, tb: IXQValue): IXQValue;
 
function xqvalueCastableAs(const cxt: TXQEvaluationContext; const ta, tb: IXQValue): IXQValue;
 
function xqvalueInstanceOf(const cxt: TXQEvaluationContext; const ta, tb: IXQValue): IXQValue;
 
function xqvalueOrPlaceholder(const cxt: TXQEvaluationContext; const a, b: IXQValue): IXQValue;
 
function xqvalueAndPlaceholder(const cxt: TXQEvaluationContext; const a, b: IXQValue): IXQValue;
 
procedure freeAnnotations(annotations: TXQAnnotations);
 
function charUnicodeZero(const cp: integer): integer;
 
procedure ignore(const intentionallyUnusedParameter: TXQEvaluationContext); inline;
 
procedure ignore(const intentionallyUnusedParameter: IXQValue); inline;
 
procedure ignore(const intentionallyUnusedParameter: TObject); inline;
 
procedure ignore(const intentionallyUnusedParameter: TXQVArray); inline;
 
function getNaN: xqfloat;
 
function getPosInf: xqfloat;
 
function getNegInf: xqfloat;
 
function isPosInf(const f: xqfloat): boolean;
 
function isNegInf(const f: xqfloat): boolean;
 
function isSignedXQFloat(const v: xqfloat): boolean;
 
function treeElementAsString(node: TTreeNode; deepSeparator: string = ''): string; inline; deprecated 'for internal use';

Warning: this symbol is deprecated: for internal use

 
function urlHexDecode(s: string): string; deprecated 'for internal use';

Warning: this symbol is deprecated: for internal use

 
procedure raiseFORG0001InvalidConversion(const v: IXQValue; const convTo: string);
 
procedure raiseXPTY0004TypeError(const v: IXQValue; const convTo: string);
 
procedure raiseFOTY0013TypeError(const v: IXQValue);
 
procedure raiseXQEvaluationError(const code, s: string; const data: IXQValue);
 

Types

PXQValue = ˆTXQValue;
 
PIXQValue = ˆIXQValue;
 
TXQVArray = array of IXQValue;
 
TXQTermArray = array of TXQTerm;
 
xqfloat = double;
 
TXQValueKind = (...);

Type of xqvalue (see TXQValue)

Values
  • pvkUndefined:  
  • pvkBoolean:  
  • pvkInt64:  
  • pvkFloat:  
  • pvkBigDecimal:  
  • pvkString:  
  • pvkQName:  
  • pvkDateTime:  
  • pvkSequence:  
  • pvkNode:  
  • pvkObject:  
  • pvkArray:  
  • pvkNull:  
  • pvkFunction:  
TXQTermFlowerOrderEmpty = (...);
 
Values
  • xqeoStatic:  
  • xqeoEmptyLeast:  
  • xqeoEmptyGreatest:  
TXQDefaultNamespaceKind = (...);
 
Values
  • xqdnkUnknown:  
  • xqdnkAny:  
  • xqdnkElementType:  
  • xqdnkType:  
  • xqdnkFunction:  
TXQPropertyDotNotation = (...);

If it is possible to access object properties with .property
xqpdnDisallowDotNotation: do not allow the dot operator anywhere
xqpdnAllowUnambiguousDotNotation: allow the dot operator when disabling it would be a syntax error. E.g. cases like ($obj).property, func(..).property, {"a": ..}.property, ...
xqpdnAllowFullDotNotation: allow the dot operator everywhere. Even in $obj.property

Values
  • xqpdnDisallowDotNotation:  
  • xqpdnAllowUnambiguousDotNotation:  
  • xqpdnAllowFullDotNotation:  
TTreeNodeSerialization = (...);
 
Values
  • tnsText:  
  • tnsXML:  
  • tnsHTML:  
TXQParsingModel = (...);
 
Values
  • xqpmXPath2:  
  • xqpmXQuery1:  
  • xqpmXPath3:  
  • xqpmXQuery3:  
PXQEvaluationContext = ˆTXQEvaluationContext;
 
TXQValueClass = class of TXQValue;
 
PXQValueDateTimeData = ˆTXQValueDateTimeData;
 
TXQValueInt64Class = class of TXQValueInt64;
 
TXQValueFloatClass = class of TXQValueFloat;
 
TXQValueDecimalClass = class of TXQValueDecimal;
 
TXQValueDateTimeClass = class of TXQValueDateTime;
 
TXQAnnotations = array of TXQAnnotation;
 
TXSConstrainingFacetKind = (...);
 
Values
  • xsfLength:  
  • xsfMinLength:  
  • xsfMaxLength:  
  • xsfPattern:  
  • xsfEnumeration:  
  • xsfMaxInclusive:  
  • xsfMinInclusive:  
  • xsfTotalDigits:  
  • xsfFractionDigits:  
  • xsfAssertions:  
  • xsfExplicitTimezone:  
TXSConstrainingFacetWhitespace = (...);
 
Values
  • xsfwAbsent:  
  • xsfwPreserve:  
  • xsfwReplace:  
  • xsfwCollapse:  
TXSConstrainingFacetExplicitTimeZone = (...);
 
Values
  • xsfetRequired:  
  • xsfetProhibited:  
  • xsfetOptional:  
TXSCastingError = (...);
 
Values
  • xsceNoError:  
  • xsceXPTY0004:  
  • xsceFORG0001:  
  • xsceFOCA0002:  
  • xsceFODT0001:  
  • xsceFODT0002:  
  • xsceFOAR0002:  
TXSNumericSubType = (...);
 
Values
  • xsstInteger:  
  • xsstDecimal:  
  • xsstFloat:  
  • xsstDouble:  
TXSStringSubType = (...);

XML Schema string type, derived from xs:string, xs:anyURI, xs:hexBinary, xs:base64Binary or xs:untypedAtomic

Values
  • xsstString:  
  • xsstHexBinary:  
  • xsstBase64Binary:  
  • xsstUrl:  
TXQDateTimeTruncation = (...);
 
Values
  • xqdttNone:  
  • xqdttTime:  
  • xqdttDate:  
  • xqdttYearMonth:  
TXSSchemaVersion = (...);
 
Values
  • xsd10:  
  • xsd11:  
TXQBasicFunction = function (argc: SizeInt; argv: PIXQValue): IXQValue;

Basic/pure function, taking some TXQValue-arguments and returning a new IXQValue.

It should not modify the values passed in the args in case there are other references, but it may assign one of them to result.

TXQComplexFunction = function (const context: TXQEvaluationContext; argc: SizeInt; argv: PIXQValue): IXQValue;

Function, taking some TXQValue-arguments and returning a new TXQValue which can depend on the current context state

It should not modify the values passed in the args in case there are other references, but it may assign one of them to result.

TXQBinaryOp = function (const cxt: TXQEvaluationContext; const a,b: IXQValue): IXQValue;

Binary operator of TXQValues

It should not modify the values passed in the args in case there are other references, but it may assign one of them to result.

PXQFunctionParameterTypes = ˆTXQFunctionParameterTypes;
 
TXQContextDependency = (...);

The dynamic/static context values a query depends on (internal used for optimizations) xqcdFocusItem: context item/node (e.g. .) xqcdFocusPosition: index (e.g. position()) xqcdFocusLast: size (e.g. last()) xqcdContextCollation, xqcdContextTime, xqcdContextVariables, xqcdContextOther: context, obvious

Values
  • xqcdFocusItem:  
  • xqcdFocusPosition:  
  • xqcdFocusLast:  
  • xqcdContextCollation:  
  • xqcdContextTime:  
  • xqcdContextVariables:  
  • xqcdContextOther:  
TXQContextDependencies = set of TXQContextDependency;
 
TXQOperatorFlags = set of (xqofAssociativeSyntax, xqofCastUntypedToString, xqofCastUntypedToDouble);

Information about a xquery binary operator

TXQPathMatchingAxis = (...);
 
Values
  • qcSameNode:  
  • qcDirectParent:  
  • qcDirectChildImplicit:  
  • qcDirectChild:  
  • qcSameOrDescendant:  
  • qcDescendant:  
  • qcFollowing:  
  • qcFollowingSibling:  
  • qcAncestor:  
  • qcPrecedingSibling:  
  • qcPreceding:  
  • qcSameOrAncestor:  
  • qcDocumentRoot:  
  • qcFunctionSpecialCase:  
  • qcAttribute:  
TXQPathMatchingKind = (...);
 
Values
  • qmValue:  
  • qmElement:  
  • qmText:  
  • qmComment:  
  • qmProcessingInstruction:  
  • qmAttribute:  
  • qmDocument:  
  • qmSchemaFail:  
  • qmCheckNamespaceURL:  
  • qmCheckNamespacePrefix:  
  • qmCheckOnSingleChild:  
TXQPathMatchingKinds = set of TXQPathMatchingKind;
 
TXQPathMatchingStepFilters = array of TXQPathMatchingStepFilter;
 
TXQPathMatching = array of TXQPathMatchingStep;
 
TTreeElementTypes = set of TTreeNodeType;
 
TXQPathNodeConditionIteration = (...);
 
Values
  • qcnciNext:  
  • qcnciPreceding:  
  • qcnciParent:  
TXQPathNodeConditionOption = (...);
 
Values
  • xqpncMatchStartNode:  
  • xqpncCheckValue:  
  • xqpncCheckNamespace:  
  • xqpncCheckOnSingleChild:  
TXQPathNodeConditionOptions = set of TXQPathNodeConditionOption;
 
PXQTerm = ˆTXQTerm;
 
PXQTermVariable = ˆTXQTermVariable;
 
TXQTerm_VisitAction = (...);
 
Values
  • xqtvaContinue:  
  • xqtvaAbort:  
  • xqtvaNoRecursion:  
TXQTerm_VisitorClass = class of TXQTerm_Visitor;
 
TXQTermClass = class of TXQTerm;
 
TXQTypeInformationKind = (...);
 
Values
  • tikNone:  
  • tikAny:  
  • tikAtomic:  
  • tikFunctionTest:  
  • tikElementTest:  
  • tikUnion:  
TXQNamespaceMode = (...);
 
Values
  • xqnmNone:  
  • xqnmURL:  
  • xqnmPrefix:  
TXQTermDefineFunctionKind = (...);
 
Values
  • xqtdfUserDefined:  
  • xqtdfNamedReference:  
  • xqtdfStaticPartialApplication:  
  • xqtdfDynamicPartialApplication:  
TXQTermNodeMatcherDirect = (...);
 
Values
  • xqnmdRoot:  
  • xqnmdParent:  
TXQTermNamedFunctionKind = (...);
 
Values
  • xqfkBasic:  
  • xqfkComplex:  
  • xqfkNativeInterpreted:  
  • xqfkUnknown:  
  • xqfkTypeConstructor:  
TXQTermFlowerSubClauseKind = (...);
 
Values
  • xqtfcFor:  
  • xqtfcLet:  
  • xqtfcWindow:  
  • xqtfcForPattern:  
  • xqtfcLetPattern:  
  • xqtfcWhere:  
  • xqtfcOrder:  
  • xqtfcCount:  
  • xqtfcGroup:  
TXQTermFlowerWindowFlags = set of (xqtfwSliding , xqtfwEndOnlyWhen);
 
TXQTermFlowerWindowVariableCallback = procedure (data: pointer; v: TXQTermVariable);
 
TXQInternalPatternMatcherParse = function (const context: TXQStaticContext; data: string): TXQTermPatternMatcher;
 
TXQInternalPatternMatcherMatch = function (template, data: TTreeNode; var context: TXQEvaluationContext; throwExceptions: boolean = false): TXQVariableChangeLog;
 
TXQInternalPatternMatcherVisit = function (const template: TXQTermPatternMatcher; visitor: TXQTerm_Visitor): TXQTerm_VisitAction;
 
TXQExceptionEvent = procedure (exception: EXQException) of object;
 
TXQEvaluateVariableEvent = function (sender: TObject; const variable: string; var value: IXQValue): boolean of object;

Event callback that is called to receive the value of the variable variable

. Should return true, if the value was changed. (returning false will cause an unknown variable exceptiono)

TXQDeclareExternalVariableEvent = procedure(sender: TObject; const context: TXQStaticContext; const namespaceUrl, variable: string; var value: IXQValue) of object;

Event callback that is called to set the value of a XQuery variable declared as "declare variable ... external"

.

The return value can be created with one of the xqvalue(..) functions.

TXQDeclareExternalFunctionEvent = procedure(sender: TObject; const context: TXQStaticContext; const namespaceURL, functionName: string; var result: TXQValueFunction) of object;

Event callback that is called to set a function value of a XQuery function declared as "declare function ... external"

.

The function in result has already been initialized with the parameters and result type, only the term in result.body has to be set.
You can either create an syntax tree for the function with the respective TXQTerm classes or derive a class from TXQTerm and override the evaluate function to calculate it natively.

TXQImportModuleEvent = procedure (sender: TObject; const namespace: string; const at: array of string) of object;
 
TXQTraceEvent = procedure (sender: TXQueryEngine; value, info: IXQValue) of object;

Event called by the fn:trace(value,info) function.

TXQParseDocEvent = procedure (sender: TXQueryEngine; data, url, contenttype: string; var node: TTreeNode) of object;

Event called by the fn:doc to parse a downloaded document.

TXQFormatIntegerModifier = (...);

Modifier for integer formatting, as described in fn:format-integer. The absence of xqfimOrdinal means cardinal , the absence of traditional means alphabetic. (traditional is a traditional way of writing integers with letters, e.g. roman numbers)

Values
  • xqfimOrdinal:  
  • xqfimTraditional:  
TXQFormatIntegerModifiers = set of TXQFormatIntegerModifier;
 
TXQFormatIntegerEvent = procedure (sender: TObject; integerNumber: BigDecimal; primaryFormat, modifierVariant, language: string; modifiers: TXQFormatIntegerModifiers; var formatted: string) of object;
 
TXQDecimalFormatProperty = (...);
 
Values
  • xqdfpDecimalSeparator:  
  • xqdfpGroupingSeparator:  
  • xqdfpMinusSign:  
  • xqdfpPercent:  
  • xqdfpPerMille:  
  • xqdfpZeroDigit:  
  • xqdfpDigit:  
  • xqdfpPatternSeparator:  
  • xqdfpExponentSeparator:  
TXQDebugTracingEvent = procedure (term: TXQTerm; const context: TXQEvaluationContext; argc: SizeInt; args: PIXQValue) of object;
 

Constants

MY_NAMESPACE_PREFIX_URL = 'http://www.benibela.de/2012/pxp/';
 
XMLNamespaceURL_XPathFunctions = 'http://www.w3.org/2005/xpath-functions';
 
XMLNamespaceURL_XPathFunctionsMath = 'http://www.w3.org/2005/xpath-functions/math';
 
XMLNamespaceURL_XMLSchema = 'http://www.w3.org/2001/XMLSchema';
 
XMLNamespaceURL_XMLSchemaInstance = 'http://www.w3.org/2001/XMLSchema-instance';
 
XMLNamespaceURL_XQueryLocalFunctions = 'http://www.w3.org/2005/xquery-local-functions';
 
XMLNamespaceURL_XQTErrors = 'http://www.w3.org/2005/xqt-errors';
 
XMLNamespaceURL_MyExtensionsMerged = MY_NAMESPACE_PREFIX_URL + 'extensions';
 
XMLNamespaceURL_MyExtensionsNew = 'http://pxp.benibela.de';
 
XMLNamespaceURL_MyExtensionOperators = MY_NAMESPACE_PREFIX_URL + 'operators';
 
XMLNamespaceURL_XQuery = 'http://www.w3.org/2012/xquery';
 
MicroSecsPerSec = int64(1000000);
 
MATCH_ALL_NODES = [qmText,qmComment,qmElement,qmProcessingInstruction,qmAttribute,qmDocument];
 

Variables

XQGlobalTrimNodes: boolean = true;

If XQGlobalTrimNodes is true, the result of every node->string conversion is trimmed. This trimming occurs after and not during the conversion.
E.g. If it is true, text() and deep-text() for <a> a </a> return 'a', and deep-text() for <x><a> a </a><a> b </a></x> returns 'a b'.
(This variable should actually be a property of TXQueryEngine, but that is not possible in the current design, since the values convert themself, and don't know their corresponding parser)

XQGlobalUseIDfromDTD: boolean = false;

If XQGlobalUseIDfromDTD is false, the fn:*id* functions will thus assume every attribute with name id is an ID attribute
If XQGlobalUseIDfromDTD is true, only real ID attributes are used. However, simplehtmltreeparser cannot handle DTDs, so it cannot detect ID attributes. So if this is true, only the wrapped fcl-xml parser from simplehtmltreeparserfpdom can be used

XQOnGlobalDebugTracing: TXQDebugTracingEvent;

Experimental event to trace the evaluation of a query

GlobalStaticNamespaces: TNamespaceList;

List of namespaces which are known in all XPath/XQuery expressions, even if they are not declared there

AllowJSONDefaultInternal: boolean = false;

Default setting for JSON (internally used).

baseSchema: TJSONiqOverrideSchema;
 
baseJSONiqSchema: TJSONiqAdditionSchema;
 
patternMatcherParse: TXQInternalPatternMatcherParse;
 
patternMatcherMatch: TXQInternalPatternMatcherMatch;
 
patternMatcherVisit: TXQInternalPatternMatcherVisit;
 
resolveHTMLCallback: TXQComplexFunction;
 
XMLNamespace_XPathFunctions: INamespace;
 
XMLNamespace_MyExtensionsNew: INamespace;
 
XMLNamespace_MyExtensionsMerged: INamespace;
 
XMLNamespace_MyExtensionOperators: INamespace;
 
XMLNamespace_XMLSchema: INamespace;
 
XQDefaultDecimalFormat: TXQDecimalFormatPropertyData = ( chars: (ord('.'), ord(','), ord('-'), ord('%'), $2030, ord('0'), ord('#'), ord(';'), ord('e') ); infinity: 'Infinity'; nan: 'NaN');
 

Author


Generated by PasDoc 0.14.0.