XmlDocument::setMetaData

API Ref

#include <DbXml.hpp>

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

void XmlDocument::setMetaData( const std::string &uri, const std::string &prefix, const std::string &name, const Dbt &dbtvalue);


Description: XmlDocument::setMetaData

The XmlDocument::setMetaData method 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 three parts; a namespace URI, a namespace prefix, and a local name. The namespace URI and prefix are optional, but 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 system reflects each typed metadata attribute into the document by adding a namespace declaration attribute and metadata attribute to the document root element. The following example associates a metadata attribute with a document:

XmlDocument document; document.setContent("<x/>"); document.setMetaData("http://acme.com/", "acme", "received", new XmlValue("1-Jan-2002"));

The system reflects the metadata attribute into the document as follows:

<x xmlns:acme= 'http://acme.com/' acme:received= '1-Jan-2002'/>

The metadata attribute can be queried using the XPath expression:

/*[@acme:received= '1-Jan-2002'].

Untyped values are passed to the API as a Dbt. They are not reflected into the document, as there is no natural representation for them in XML or XPath.

Parameters

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

prefix
The prefix for the namespace.

name
The name of the metadata attribute.

value
A Number, String, or Boolean value.

dbtvalue - A Berkeley DB Dbt.


Class

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

APIRef

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