XmlContainer::getNode

#include <DbXml.hpp>

XmlValue getNode(const std::string &nodeHandle, u_int32_t flags = 0)

XmlDocument getNode(
    XmlTransaction &txn, const std::string &nodeHandle, 
    u_int32_t flags = 0)

The XmlContainer::getNode method returns the XmlValue of type XmlValue::NODE representing the specified handle. The handle must represent a node in a document in the XmlContainer . If the document or node has been removed, the operation may fail.

Node handles are guaranteed to remain stable in the absence of modifications to a document. If a document is modified, a handle may cease to exist, or may belong to a different node.

Parameters

txn

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

nodeHandle

The handle representing the node which must have been obtained using XmlValue::getNodeHandle.

flags

This parameter must be set to 0 or one the following values:

  • DB_READ_UNCOMMITTED

    This operation will support degree 1 isolation; that is, read operations may return data that has been modified by other transactions but which has not yet been committed. Silently ignored if the DB_READ_UNCOMMITTED flag was not specified when the underlying container was opened.

  • DB_READ_COMMITTED

    This operation will have degree 2 isolation. This provides for cursor stability but not repeatable reads. Data items which have been previously read by this transaction may be deleted or modified by other transactions before this transaction completes.

  • DB_RMW

    Acquire write locks instead of read locks when doing the read, if locking is configured. Setting this flag can eliminate deadlock during a read-modify-write cycle by acquiring the write lock during the read part of the cycle so that another thread of control acquiring a read lock for the same item, in its own read-modify-write cycle, will not result in deadlock.

  • DBXML_LAZY_DOCS

    Retrieve the document lazily. That is, retrieve document content and document metadata only on an as needed basis when reading the document.

Errors

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

DATABASE_ERROR

An error occurred in an underlying Berkeley DB database. The XmlException::getDbErrno method will return the error code for the error.

DOCUMENT_NOT_FOUND

The node and/or document specified by the handle is not in the XmlContainer.

Class

XmlContainer

See Also

XmlContainer Methods