XmlValue

API Ref

import com.sleepycat.dbxml.*;

public class XmlValue extends Object { XmlValue(int flags); public XmlValue(String v) throws XmlException; public XmlValue(double v) throws XmlException; public XmlValue(boolean v) throws XmlException; public XmlValue(XmlDocument v) throws XmlException; public XmlValue(int type, String v) throws XmlException; public int getType(XmlQueryContext context) throws XmlException; public boolean isNumber(XmlQueryContext context) throws XmlException; public boolean isString(XmlQueryContext context) throws XmlException; public boolean isBoolean(XmlQueryContext context) throws XmlException; public boolean isNode(XmlQueryContext context) throws XmlException; public boolean isDocument(XmlQueryContext context) throws XmlException; public boolean isVariable(XmlQueryContext context) throws XmlException; public boolean isNull() throws XmlException; public double asNumber(XmlQueryContext context) throws XmlException; public String asString(XmlQueryContext context) throws XmlException; public boolean asBoolean(XmlQueryContext context) throws XmlException; public XmlDocument asDocument(XmlQueryContext context) throws XmlException; public boolean equals(XmlValue v, XmlQueryContext context) throws XmlException; ... }


Description: XmlValue

The XmlValue class encapsulates the value of a node in an XML document. XPath 1.0 defines three value types: Boolean, String, and Number. Berkeley DB XML additionally defines the value types None, Node, Document, and Variable.

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.

Java Type or ClassXmlValue Type
No parameterNull
StringString
doubleNumber
booleanBoolean
XmlDocumentDocument
type and StringString is converted to the specified type.

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.


Description: XmlValue()


Description: XmlValue(String)

Construct an XmlValue object of value type String.

Parameters

v
The XmlValue object value.

Description: XmlValue(double)

Construct an XmlValue object of value type Number.

Parameters

v
The XmlValue object value.

Description: XmlValue(boolean)

Construct an XmlValue object of value type Boolean.

Parameters

v
The XmlValue object value.

Description: XmlValue(Type, String)

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

Parameters

type
The XmlValue object value type.

v
The XmlValue object value.

Description: XmlValue(XmlDocument)

Construct an XmlValue object of value type Document.

Parameters

v
The XmlValue object value.

Description: XmlValue.isNumber(XmlQueryContext)

Test if the XmlValue is of type Number.

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.

Returns true if the value is a Number.


Description: XmlValue.isString(XmlQueryContext)

Test if the XmlValue is of type String.

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.

Returns true if the value is a String.


Description: XmlValue.isBoolean(XmlQueryContext)

Test if the XmlValue is of type Boolean.

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.

Returns true if the value is a Boolean.


Description: XmlValue.isNode(XmlQueryContext)

Test if the XmlValue is of type Node.

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.

Returns true if the value is a Node.


Description: XmlValue.isDocument(XmlQueryContext)

Test if the XmlValue is of type Node.

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.

Returns true if the value is a Node.


Description: XmlValue.isVariable(XmlQueryContext)

Test if the XmlValue is of type Node.

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.

Returns true if the value is a Node.


Description: XmlValue.getType(XmlQueryContext)

Returns the type of the XmlValue . The enumeration values are XmlValue.NONE, XmlValue.STRING, XmlValue.NUMBER, XmlValue.BOOLEAN, XmlValue.DOCUMENT, XmlValue.NODE, XmlValue.VARIABLE.

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.

Description: XmlValue.asNumber(XmlQueryContext)

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.
Returns the value as a Number.

Description: XmlValue.asString(XmlQueryContext)

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.
Returns the value as a String.

Description: XmlValue.asBoolean(XmlQueryContext)

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.
Returns the value as a Boolean

Description: XmlValue.asDocument(XmlQueryContext)

Parameters

context
The query context is required to determine the value of an XmlValue of type variable.
Returns the value as a Document.

Description: XmlValue.isNull()

The isNull() method returns true if the XmlValue has no value.


Description: XmlValue.equals(XmlValue,XmlQueryContext)

The equals() method determines if two XmlValue objects represent the same value.

Parameters

value
The value to compare this value with.

context
The query context is required to determine the value of an XmlValue of type variable.
Returns true if the two XmlValue objects represent the same value.

The copy constructor and assignment operator are provided for this class. The class is implemented using a handle-body idiom. When a handle is copied both handles maintain a reference to the same body.

Throws

The XmlValue cast methods may fail and throw XmlException, encapsulating one of the following non-zero errors:

NO_VARIABLE_BINDING
No query context was provided, or the query context does not contain a value for the XmlValue of type variable.

Class

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

APIRef

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