XmlManager::prepare

#include <DbXml.hpp>

XmlQueryExpression XmlManager::prepare(const std::string &xquery,
    XmlQueryContext &context)

XmlQueryExpression XmlManager::prepare(XmlTransaction &txn,
    const std::string &xquery, XmlQueryContext &context)

Compile an XQuery expression into an XmlQueryExpression object. You can then run the XQuery expression repeatedly using XmlQueryExpression::execute.

Use this method to compile and evaluate XQuery expressions against your XmlContainer and XmlDocument objects any time you want to evaluate the expression more than once.

Note that the scope of the query provided here can be restricted using one of the XQuery navigational functions. For example:

"collection('mycontainer.dbxml')/foo"

or:

"doc('dbxml:/mycontainer.dbxml/mydoc.xml')/foo/@attr1='bar'"

The scope of a query can also be controlled by passing an appropriate contextItem object to XmlQueryExpression::execute.

Parameters

txn

If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from XmlManager::createTransaction.

xquery

The XQuery query string to compile.

context

The XmlQueryContext to use for this query.

Class

XmlManager

See Also

XmlManager Methods