### XmlDocument::queryWithXPath |

`

###

    #include <DbXml.hpp>

    XmlResults XmlDocument::queryWithXPath(const std::string &query, XmlQueryContext *context=0);
    XmlResults XmlDocument::queryWithXPath(const XmlQueryExpression &query);

### Description: XmlDocument::queryWithXPath

The XmlDocument::queryWithXPath method executes an XPath expression against the XmlDocument, and returns the results.

The query may optionally be executed within an XmlQueryContext, which describes how the query is to be performed. If no context is specified the default context is used. The default query context defines the namespace prefix "dbxml", contains no variable bindings, and specifies that the method should return the set of values selected by the XPath expression.

### Parameters

query
  The XPath expression provided as a string, conforming to the syntax defined in the W3C XPath 1.0 specification.

context
  The context within which the query is to be performed. The context contains the variable bindings, the namespace prefix to URI mapping, and the query processing flags.

The result of the query.

### Errors

The XmlDocument::queryWithXPath method may fail and throw XmlException, encapsulating one of the following non-zero errors:

DOM_PARSER_ERROR
  The DOM parser was unable to parse an XML document.

NO_VARIABLE_BINDING
  The XPath expression referred to an undefined variable.

XPATH_EVALUATION_ERROR
  The XPath evaluator was unable to execute the XPath expression.

XPATH_PARSER_ERROR
  The XPath parser could not parse the XPath expression.

### Description: XmlDocument::queryWithXPath

The XmlDocument::queryWithXPath method executes an XPath expression against the XmlDocument, and returns the results.

### Parameters

query
  The XPath expression as an XmlQueryExpression.

context
  The context within which the query is to be performed. The context contains the variable bindings, the namespace prefix to URI mapping, and the query processing flags.

The result of the query.

### Errors

The XmlDocument::queryWithXPath method may fail and throw XmlException, encapsulating one of the following non-zero errors:

DOM_PARSER_ERROR
  The DOM parser was unable to parse an XML document.

NO_VARIABLE_BINDING
  The XPath expression referred to an undefined variable.

XPATH_EVALUATION_ERROR
  The XPath evaluator was unable to execute the XPath expression.

XPATH_PARSER_ERROR
  The XPath parser could not parse the XPath expression.

### Class

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

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