|
Berkeley DbXML version 1.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.dbxml.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 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.
Field Summary | |
static int |
BINARY
|
static int |
BOOLEAN
|
static int |
DOCUMENT
|
static int |
NODE
|
static int |
NONE
|
static int |
NUMBER
|
static int |
STRING
|
static int |
VARIABLE
|
Constructor Summary | |
XmlValue()
|
|
XmlValue(boolean v)
Construct an XmlValue object of value type Boolean. |
|
XmlValue(double v)
Construct an XmlValue object of value type Number. |
|
XmlValue(int type,
String v)
Construct an XmlValue object of the value type provided, converting the string value to the specified type. |
|
XmlValue(String v)
Construct an XmlValue object of value type String. |
|
XmlValue(XmlDocument v)
Construct an XmlValue object of value type Document. |
Method Summary | |
boolean |
asBoolean(XmlQueryContext context)
|
XmlDocument |
asDocument(XmlQueryContext context)
|
double |
asNumber(XmlQueryContext context)
|
String |
asString(XmlQueryContext context)
|
void |
delete()
|
boolean |
equals(XmlValue value,
XmlQueryContext context)
The equals() method determines if two XmlValue objects represent the same value. |
int |
getType(XmlQueryContext context)
|
boolean |
isBoolean(XmlQueryContext context)
Test if the XmlValue is of type Boolean. |
boolean |
isDocument(XmlQueryContext context)
Test if the XmlValue is of type Node. |
boolean |
isNode(XmlQueryContext context)
Test if the XmlValue is of type Node. |
boolean |
isNull()
|
boolean |
isNumber(XmlQueryContext context)
Test if the XmlValue is of type Number. |
boolean |
isString(XmlQueryContext context)
Test if the XmlValue is of type String. |
boolean |
isVariable(XmlQueryContext context)
Test if the XmlValue is of type Node. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NONE
public static final int STRING
public static final int NUMBER
public static final int BOOLEAN
public static final int DOCUMENT
public static final int NODE
public static final int VARIABLE
public static final int BINARY
Constructor Detail |
public XmlValue() throws XmlException
XmlException
public XmlValue(XmlDocument v) throws XmlException
v
- The XmlValue object value.
XmlException
public XmlValue(double v) throws XmlException
v
- The XmlValue object value.
XmlException
public XmlValue(String v) throws XmlException
v
- The XmlValue object value.
XmlException
public XmlValue(boolean v) throws XmlException
v
- The XmlValue object value.
XmlException
public XmlValue(int type, String v) throws XmlException
type
- The XmlValue object value type.v
- The XmlValue object value.
XmlException
Method Detail |
public void delete()
public int getType(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public boolean isNumber(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public boolean isString(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public boolean isBoolean(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public boolean isNode(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public boolean isDocument(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public boolean isVariable(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public boolean isNull() throws XmlException
XmlException
public double asNumber(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public String asString(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public boolean asBoolean(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public XmlDocument asDocument(XmlQueryContext context) throws XmlException
context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
public boolean equals(XmlValue value, XmlQueryContext context) throws XmlException
value
- The value to compare this value with.context
- The query context is required to determine the value of an XmlValue of type variable.
XmlException
XmlException
- The XmlValue cast methods may fail and throw XmlException
, encapsulating one of the following non-zero errors:
|
Berkeley DbXML version 1.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |