XmlContainer::putDocument

API Ref

#include <DbXml.hpp>

void XmlContainer::putDocument(XmlDocument &document, XmlUpdateContext &context, u_int32_t flags = 0)

void XmlContainer::putDocument(XmlTransaction &txn, XmlDocument &document, XmlUpdateContext &context, u_int32_t flags = 0)

std::string XmlContainer::putDocument(const std::string &name, XmlInputStream *adopted_input, XmlUpdateContext &context, u_int32_t flags = 0)

std::string XmlContainer::putDocument(XmlTransaction &txn, const std::string &name, XmlInputStream *adopted_input, XmlUpdateContext &context, u_int32_t flags = 0)

std::string XmlContainer::putDocument(const std::string &name, const std::string &contents, XmlUpdateContext &context, u_int32_t flags = 0)

std::string XmlContainer::putDocument(XmlTransaction &txn, const std::string &name, const std::string &contents, XmlUpdateContext &context, u_int32_t flags = 0)


Description: XmlContainer::putDocument

Inserts an XmlDocument into the container. The value returned by this method is dependent upon the form of the method that you used to perform the insertion.

Note that the name used for the document must be unique in the container or an exception is thrown. The flag, DBXML_GEN_NAME, can be used to generate a name. To change a document that already exists in the container, use XmlContainer::updateDocument.

The document content is indexed according to the container indexing specification. The indexer supports the Xerces content encodings and expects the content to be well-formed, but it need not be valid.


Description: void XmlContainer::putDocument(XmlTransaction &txn, XmlDocument &document, XmlUpdateContext &context, u_int32_t flags = 0)

Inserts the XmlDocument provided on the call to the container. The name provided for the XmlDocument must be unique to the container or an exception is thrown. To set the name, use XmlDocument::setName.

Parameters

txn
If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from XmlManager::createTransaction.
document
The XmlDocument to be inserted into the XmlContainer.
context
The update context to use for the document insertion.
flags
The flags parameter must be set to 0 or the following value:
DBXML_GEN_NAME
Generate a unique name. If no name is set for this XmlDocument, a system-defined unique name is generated. If a name is specified, a unique string is appended to that name to ensure uniqueness.

Errors

The XmlContainer::putDocument 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.
INDEXER_PARSER_ERROR
The XML Indexer could not parse the document.
UNIQUE_ERROR
Uniqueness constraint violation for key

Description: std::string XmlContainer::putDocument(XmlTransaction &txn, std::string &name, XmlInputStream *adopted_input, XmlUpdateContext &context, u_int32_t flags = 0)

Inserts the XML document contained in the XmlInputStream into the container. The name used for the new document is returned by this method.

Parameters

txn
If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from XmlManager::createTransaction.
name
Provides the name of the document to insert into the container. This name must be unique in the container. If DBXML_GEN_NAME is set, a system-defined string is appended to create a unique name. This applies if the name parameter is provided or empty. If the name is not unique within the container, an exception is thrown.
adopted_input
Identifies the input stream to use to read the document. Create the input stream using one of XmlManager::createLocalFileInputStream, XmlManager::createMemBufInputStream, XmlManager::createStdInInputStream, XmlManager::createURLInputStream, or XmlDocument::getContentAsXmlInputStream. The content read by the input stream must well-formed XML, or an exception is thrown. The XmlInputStream object provided is consumed (deleted) by this method.
context
The update context to use for the document insertion.
flags
The flags parameter must be set to 0 or the following value:
DBXML_GEN_NAME
Automatically generate a name for the document.

Errors

The XmlContainer::putDocument 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.
INDEXER_PARSER_ERROR
The XML Indexer could not parse the document.
UNIQUE_ERROR
Uniqueness constraint violation for key

Description: std::string XmlContainer::putDocument(XmlTransaction &txn, std::string &name, const std::string &contents, XmlUpdateContext &context, u_int32_t flags = 0)

Inserts the XML document contained in the XmlInputStream into the container. The name used for the new document is returned by this method.

Parameters

txn
If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from XmlManager::createTransaction.
name
Provides the name of the document to insert into the container. This name must be unique in the container. If DBXML_GEN_NAME is set, a system-defined string is appended to create a unique name. This applies if the name parameter is provided or empty. If the name is not unique within the container, an exception is thrown.
contents
The XML content to insert into the container. The content contained in this string must well-formed XML, or an exception is thrown.
context
The update context to use for the document insertion.
flags
The flags parameter must be set to 0 or the following value:
DBXML_GEN_NAME
Automatically generate a name for the document.

Errors

The XmlContainer::putDocument 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.
INDEXER_PARSER_ERROR
The XML Indexer could not parse the document.
UNIQUE_ERROR
Uniqueness constraint violation for key

APIRef

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