XmlModify::execute

API Ref

#include <DbXml.hpp>

unsigned int XmlModify::execute(XmlValue &toModify, XmlQueryContext &context, XmlUpdateContext &uc) const

unsigned int XmlModify::execute(XmlResults &toModify, XmlQueryContext &context, XmlUpdateContext &uc) const

unsigned int XmlModify::execute(XmlTransaction &txn, XmlValue &toModify, XmlQueryContext &context, XmlUpdateContext &uc) const

unsigned int XmlModify::execute(XmlTransaction &txn, XmlResults &toModify, XmlQueryContext &context, XmlUpdateContext &uc) const


Description: XmlModify::execute

Executes one or more document modification operations (or steps) against an XmlResults or XmlValue object. Upon completing the modification, the modified document is optionally updated in the backing XmlContainer for you. Returns the number of nodes modified.

If the XmlUpdateContext object state is set to apply changes to the backing container (the default), modifications are automatically written back to the container. This state is controlled using XmlUpdateContext::setApplyChangesToContainers.

Note that the modification steps are executed in the order that they were specified to this object. Modification steps are specified using XmlModify::addAppendStep, XmlModify::addInsertAfterStep, XmlModify::addInsertBeforeStep, XmlModify::addRemoveStep, XmlModify::addRenameStep, and XmlModify::addUpdateStep.

This method can thrown an exception for any number of reasons; the most common being that an illegal modification was requested. In addition, if a resulting document is not well-formed XML, this method will throw a parsing exception if that document is written to its container.


Description: unsigned int XmlModify::execute(XmlTransaction &txn, XmlValue &toModify, XmlQueryContext &context, XmlUpdateContext &uc) const

Modifies the document contained in toModify and then optionally writes the modified document to the backing container. Return the number of nodes modified.

If the XmlUpdateContext object state is set to apply changes to the backing container (the default), modifications are automatically written back to the container. This state is controlled using XmlUpdateContext::setApplyChangesToContainers.

Parameters

txn
If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from XmlManager::createTransaction.
toModify
The XmlValue to modify using this collection of modification steps.
context
The XmlQueryContext to use for this modification.
uc
The XmlUpdateContext to use for this modification.

Errors

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

INVALID_VALUE
Append operation is only valid for Element targets
INVALID_VALUE
Cannot create another element child of the document node
INVALID_VALUE
cannot insert before an attribute
INVALID_VALUE
cannot insert after an attribute
INVALID_VALUE
cannot insert before a node with no parent
INVALID_VALUE
cannot insert after a node with no parent
INVALID_VALUE
Cannot create an element sibling of the document root
INVALID_VALUE
attributes can only be added to elements
INVALID_VALUE
cannot remove node that doesn't have a parent
INVALID_VALUE
cannot remove the document element
INVALID_VALUE
can only rename elements, attributes, and processing instructions
INDEXER_PARSER_ERROR
Fatal Parse error in document

Description: unsigned int XmlModify::execute(XmlTransaction &txn, XmlResults &toModify, XmlQueryContext &context, XmlUpdateContext &uc) const

Modifies the document contained in toModify and then writes the modified document to the backing container.

Parameters

txn
If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from XmlManager::createTransaction.
toModify
The XmlResults object containing the result set to modify. Note that the modification occurs from the current position in the results set and proceeds until the end of the results set is reached. This means that if you iterated over the results set prior to passing the XmlResults object to this method, you must call XmlResults::reset or no modifications will occur.
context
The XmlQueryContext to use for this modification.
uc
The XmlUpdateContext to use for this modification.

Errors

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

INVALID_VALUE
Append operation is only valid for Element targets
INVALID_VALUE
Cannot create another element child of the document node
INVALID_VALUE
cannot insert before an attribute
INVALID_VALUE
cannot insert after an attribute
INVALID_VALUE
cannot insert before a node with no parent
INVALID_VALUE
cannot insert after a node with no parent
INVALID_VALUE
Cannot create an element sibling of the document root
INVALID_VALUE
attributes can only be added to elements
INVALID_VALUE
cannot remove node that doesn't have a parent
INVALID_VALUE
cannot remove the document element
INVALID_VALUE
can only rename elements, attributes, and processing instructions
INDEXER_PARSER_ERROR
Fatal Parse error in document

APIRef

Copyright (c) 1996,2007 Oracle. All rights reserved.