XmlContainer.putDocument |
![]() ![]() |
import com.sleepycat.dbxml.*;public int putDocument(DbTxn txnid, XmlDocument xmldoc, int flags) throws DbException;
The XmlContainer.putDocument method stores a XML document into the container and returns the document ID. The contents of an XmlDocument may be of type Db.XmlDocument::BYTES or Db.XmlDocument::XML. XML content is parsed and indexed as per the container indexing specification. Non-XML (Db.XmlDocument::BYTES) content is not indexed.
Regardless of the content type the document annotation attributes are always indexed.]
The XML indexer expects XML content to be encoded as UTF-8. The indexer also expects the XML content to be well-formed, but the content need not be valid.
If the operation is to be transaction-protected (other than by specifying the Db.DB_AUTO_COMMIT flag), the txnid parameter is a transaction handle returned from DbEnv.txn_begin; otherwise, null.
The flags value must be set to 0 or the following value:
The XmlContainer.putDocument method returns a document ID on success. Otherwise, the XmlContainer.putDocument method throws an exception that encapsulates a non-zero error value on failure.
If the operation was selected to resolve a deadlock, the XmlContainer.putDocument method will fail and throw a DbDeadlockException exception.
The XmlContainer.putDocument method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. If a catastrophic error has occurred, the XmlContainer.putDocument method may fail and throw a DbRunRecoveryException, in which case all subsequent Berkeley DB calls will fail in the same way.
XmlDocument.getAttributeValue, XmlDocument.getContent, XmlDocument.getID, XmlDocument.getName, XmlDocument.getType, XmlDocument.setContent, XmlDocument.setName, and XmlDocument.setType.
![]() ![]() |