XmlValue |
![]() ![]() |
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; ... }
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 Class | XmlValue Type |
---|---|
No parameter | Null |
String | String |
double | Number |
boolean | Boolean |
XmlDocument | Document |
type and String | String 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.
Construct an XmlValue object of value type String.
Construct an XmlValue object of value type Number.
Construct an XmlValue object of value type Boolean.
Construct an XmlValue object of the value type provided, converting the string value to the specified type.
Construct an XmlValue object of value type Document.
Test if the XmlValue is of type Number.
Returns true if the value is a Number.
Test if the XmlValue is of type String.
Returns true if the value is a String.
Test if the XmlValue is of type Boolean.
Returns true if the value is a Boolean.
Test if the XmlValue is of type Node.
Returns true if the value is a Node.
Test if the XmlValue is of type Node.
Returns true if the value is a Node.
Test if the XmlValue is of type Node.
Returns true if the value is a Node.
Returns the type of the XmlValue . The enumeration values are XmlValue.NONE, XmlValue.STRING, XmlValue.NUMBER, XmlValue.BOOLEAN, XmlValue.DOCUMENT, XmlValue.NODE, XmlValue.VARIABLE.
The isNull() method returns true if the XmlValue has no value.
The equals() method determines if 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.
The XmlValue cast methods may fail and throw XmlException, encapsulating one of the following non-zero errors:
![]() ![]() |
Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.