XmlDocument::setMetaData

#include <DbXml.hpp>

void XmlDocument::setMetaData(
    const std::string &uri,
    const std::string &name,
    const XmlValue &value);

void XmlDocument::setMetaData(
    const std::string &uri,
    const std::string &name,
    const XmlData &value);

Sets the value of the specified metadata attribute. A metadata attribute is a name-value pair, which is stored with the document, but not as part of the document content. The value of a metadata attribute may be typed or untyped.

A metadata attribute name consists of a namespace URI and a name. The namespace URI is optional but it should be used to avoid naming collisions.

Typed values are passed to the API as an instance of XmlValue , and may be of type Number, String, or Boolean.

The metadata attribute can be queried using an XQuery query that makes use of the special dbxml:metadata() function from within a predicate. To make use of this function, you must define a namespace for use with the query (it can be any random namespace). For example, suppose you had metadata whose name was "dateStamp". Then to query for documents that have a specific dateStamp value:

myQueryContext.setNamespace("ds", "http://randomNS/"); std::string 
myQuery="/*dbxml:metadata('ds:dateStamp')='10/30/2004'";

Untyped values are passed to the API as a XmlData .

If a given metadata attribute is indexed, it is possible to use XmlContainer::lookupIndex to perform fast lookup.

Parameters

uri

The namespace within which the name resides. The empty string refers to the default namespace.

name

The name of the metadata attribute.

value

The XmlValue or XmlData to be used for the metadata value.

Class

XmlDocument

See Also

XmlDocument Methods