XmlIndexSpecification::addIndex API Ref

#include <DbXml.hpp>

void XmlIndexSpecification::addIndex( const std::string &uri, const std::string &name, const std::string &index)

void XmlIndexSpecification::addIndex( const std::string &uri, const std::string &name, Type type, XmlValue::Type syntax)


Description: XmlIndexSpecification::addIndex

Adds an index to the index specification. You then set the index specification using XmlContainer::setIndexSpecification.

You identify the indexing strategy that you want to add to the index specification in one of two ways. The first way is to provide a string that identifies the desired indexing strategy. The second is to use XmlIndexSpecification::Type and XmlValue::Type constants to identify the same information.

Either way, an index strategy is set by providing the name of a node and one or more indexing strategies for that node. The node name can be either that of an element, attribute, or metadata node. Metadata nodes are used only for indexing metadata. Element and attribute nodes are used for indexing XML document content. For example, in the XML fragment:

"<art title='...'/>"

there are two node names that index strategies could be specified for, the element node name is 'art', and the attribute node name is 'title'.

When specifying indexing strategies, you must provide the following information:

In addition to setting index strategies for specified nodes, applications can also specify a default indexing strategy for all nodes in a container by using XmlIndexSpecification::addDefaultIndex. When a container is first created the default indexing strategy is 'unique-node-metadata-equality-string'.

For more information on designing an indexing strategy for your application, see the Berkeley DB XML Getting Started Guide.


Description: void XmlIndexSpecification::addIndex(const std::string &uri, const std::string &name, const std::string &index)

Identifies one or more indexing strategies to set for the identified node. The strategies are identified as a space-separated listing of strings.

Parameters
uri name index

Errors

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


UNKNOWN_INDEX

Description: void XmlIndexSpecification::addIndex(const std::string &uri, const std::string &name, Type type, XmlValue::Type syntax)

Identifies an indexing strategy to set for the identified node. The strategy is set using enumeration values for the index and the syntax.

Parameters
uri name type syntax

Errors

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


UNKNOWN_INDEX

APIRef

Copyright (c) 1996-2009 Oracle. All rights reserved.