### XmlContainer.modifyDocument |

`

###

    import com.sleepycat.dbxml.*;

    public void modifyDocument(DbTxn txn, XmlModify modify,
    			   XmlUpdateContext context, int flags)
        throws XmlException;

### Description: XmlContainer.modifyDocument

The XmlContainer.modifyDocument method performs in-place modification of all XmlDocuments in the XmlContainer according to the state of the XmlModify object, which contains an XPath expression to target document nodes, as well as specification of the modifications to perform. All affected XmlDocument objects and indexes are updated. In order to determine how many modification operations were performed, the XmlModify.getNumModifications method should be used.

### Parameters

txn
  If the operation is to be transaction-protected, the txn parameter is a transaction handle returned from DbEnv.txnBegin, otherwise, NULL.

modify
  The XmlModify object describing how to change the target documents. It encapsulates the XPath query, which specifies the target nodes in the document, as well as the modification operation to perform, with associated arguments.

context
  The optional XmlUpdateContext used for the update operations on the XmlContainer. There are potential performance benefits when this object is reused across operations that modify an XmlContainer.

flags
  The flags parameter must be set to zero or one of the following values:

  Db.DB_RMW
    Acquire write locks instead of read locks when doing the retrieval. 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.

### Throws

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

CONTAINER_CLOSED
  The container is closed.

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

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.

INVALID_VALUE
  The operation requested could not be performed on the target node(s), as specified by the XmlModify object.

### Class

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

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