XmlValue

API Ref

#include <DbXml.hpp>

class DbXml::XmlValue { public: XmlValue(); XmlValue(const std::string &value); XmlValue(const char *value); XmlValue(double value); XmlValue(bool value); XmlValue(const XmlDocument &document); XmlValue(Type type, const std::string &value); XmlValue(Type type, const XmlData &data);

virtual ~XmlValue(); XmlValue(const XmlValue &); XmlValue &operator=(const XmlValue &); bool operator==(const XmlValue &v) const bool equals(const XmlValue &v) const; bool isNull() const; ... };


Description: XmlValue

The XmlValue class encapsulates the value of a node in an XML document. The type of the value may be any one of the enumerated types in the XmlValue::Type enumeration. There are convenience operators for specially handling the types of STRING, DOUBLE, and BOOLEAN, as well as a constructor to make an XmlValue from XmlDocument.

The XmlValue class provides several constructors, each of which maps a C++ type or Berkeley DB XML class onto an appropriate XmlValue type. The following table lists the constructor parameter mappings.

C++ Type or ClassXmlValue Type
No parameterNONE
std::string or const char*STRING
doubleDOUBLE
boolBOOLEAN
XmlDocumentNODE
Type and std::stringString is converted to the specified type.
Type and XmlDataXmlData is converted to the specified type.

The Type may be any of of the following:

The XmlValue class implements a set of methods that test if the XmlValue is of a named type. The XmlValue class also implements a set of methods that return the XmlValue as a value of a specified type. If the XmlValue is of type variable and no query context is provided when calling the test or cast methods, or no binding can be found for the variable, an exception is thrown.

In addition to type conversion, the XmlValue class also provides DOM-like navigation functions. Using these, you can retrieve features from the underlying document, such as the parent, an attribute, or a child of the current node.

This object is not thread-safe, and can only be safely used by one thread at a time in an application.

Description: XmlValue(std::string &value) or XmlValue(const char *value)

Construct an XmlValue object of value type STRING.

Parameters

value
The XmlValue object value.

Description: XmlValue(double value)

Construct an XmlValue object of value type DOUBLE.

Parameters

value
The XmlValue object value.

Description: XmlValue(bool value)

Construct an XmlValue object of value type BOOLEAN.

Parameters

value
The XmlValue object value.

Description: XmlValue(Type, const std::string &value) or XmlValue(Type, const XmlData &value)

Construct an XmlValue object of the value Type provided, converting the string value to the specified type.

Parameters

type
The XmlValue object value type.
value
The XmlValue object value.

Description: XmlValue(XmlDocument &document)

Construct an XmlValue object of value type NODE.

Parameters

document
The XmlValue object value.

Description: XmlValue::isNull()

Returns true if the XmlValue has no value (type NONE).


Description: XmlValue::equals(XmlValue &value)

Determines if two XmlValue objects represent the same value. It returns true if the two XmlValue objects represent the same value.

Parameters

value
The value to compare this value with.

APIRef

Copyright (c) 1996,2007 Oracle. All rights reserved.