XmlQueryContext

API Ref

#include <DbXml.hpp>

class DbXml::XmlQueryContext { public: XmlQueryContext(ReturnType rt=ResultDocuments, EvaluationType et=Eager); XmlQueryContext(const XmlQueryContext &); ~XmlQueryContext(); XmlQueryContext &operator = (const XmlQueryContext &) ... };


Description: XmlQueryContext

The XmlQueryContext class encapsulates the context within which a query is performed against an XmlContainer. The context includes a namespace mapping, variable bindings, and flags that indicate how the query result set should be determined and returned to the caller. Multiple queries can be executed within the same XmlQueryContext.

The XmlQueryContext constructor accepts parameters that define whether queries executed within the context are to be evaluated lazily or eagerly, and whether the query is to return candidate documents, result documents, or result values. For detailed descriptions of these parameters see XmlQueryContext::setReturnType and XmlQueryContext::setEvaluationType.

The XPath query syntax permits expressions to refer to namespace prefixes, but not to define them. The XmlQueryContext class provides namespace management methods so that the caller may manage the namespace prefix to URI mapping. By default the prefix "dbxml" is defined to be "http://www.sleepycat.com/2002/dbxml".

The XPath syntax also permits expressions to refer to variables, but not to define them. The XmlQueryContext class provides methods that allow the caller to manage the variable to value bindings.

A copy constructor and assignment operator are provided for this class. The class is implemented using a handle-body idiom. When a handle is copied both handles maintain a reference to the same body.

Parameters

returnType
The type parameter specifies which of documents or values to return, and must be set to one of the following values:

XmlQueryContext::ResultDocuments
Return documents that match the XPath expression.

XmlQueryContext::ResultValues
Return nodes from the documents that match the XPath expression.

XmlQueryContext::ResultDocumentsAndValues
Return both the nodes from the documents that match the query expression, and the matching documents.

XmlQueryContext::CandidateDocuments
Return documents that may match the query expression.

evaluationType
The evaluation type must be specified as either:

XmlQueryContext::Eager
The query is executed and its resultant values are derived and stored in-memory before a call to XmlContainer::queryWithXPath returns.

XmlQueryContext::Lazy
Minimal processing is performed before XmlContainer::queryWithXPath returns, and the remaining processing is deferred until the result set is enumerated.

Class

XmlContainer, XmlDocument, XmlException, XmlIndexSpecification, XmlQueryContext, XmlQueryExpression, XmlResults, XmlUpdateContext, XmlValue

APIRef

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.