public class XmlValue
extends java.lang.Object
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 Java type or Berkeley DB XML class onto an appropriate XmlValue type. The following table lists the constructor parameter mappings.
This object is not thread-safe, and can only be safely used by one thread at a time in an application.
| Modifier and Type | Field and Description |
|---|---|
static int |
ANY_SIMPLE_TYPE |
static int |
ANY_URI |
static int |
ATTRIBUTE_NODE
Node type returned by
getNodeType(). |
static int |
BASE_64_BINARY |
static int |
BOOLEAN |
static int |
CDATA_SECTION_NODE
Node type returned by
getNodeType(). |
static int |
COMMENT_NODE
Node type returned by
getNodeType(). |
static int |
DATE |
static int |
DATE_TIME |
static int |
DAY_TIME_DURATION |
static int |
DECIMAL |
static int |
DOCUMENT_FRAGMENT_NODE
Node type returned by
getNodeType(). |
static int |
DOCUMENT_NODE
Node type returned by
getNodeType(). |
static int |
DOCUMENT_TYPE_NODE
Node type returned by
getNodeType(). |
static int |
DOUBLE |
static int |
DURATION |
static int |
ELEMENT_NODE
Node type returned by
getNodeType(). |
static int |
ENTITY_NODE
Node type returned by
getNodeType(). |
static int |
ENTITY_REFERENCE_NODE
Node type returned by
getNodeType(). |
static int |
FLOAT |
static int |
G_DAY |
static int |
G_MONTH |
static int |
G_MONTH_DAY |
static int |
G_YEAR |
static int |
G_YEAR_MONTH |
static int |
HEX_BINARY |
static int |
NODE |
static int |
NONE |
static int |
NOTATION |
static int |
NOTATION_NODE
Node type returned by
getNodeType(). |
static int |
PROCESSING_INSTRUCTION_NODE
Node type returned by
getNodeType(). |
static int |
QNAME |
static int |
STRING |
static int |
TEXT_NODE
Node type returned by
getNodeType(). |
static int |
TIME |
static int |
UNTYPED_ATOMIC |
static int |
YEAR_MONTH_DURATION |
| Constructor and Description |
|---|
XmlValue()
Public constructor.
|
XmlValue(boolean v)
Construct a value from a boolean.
|
XmlValue(double v)
Construct a value from a double.
|
XmlValue(int type,
byte[] dbt)
Construct a typed value from a byte array.
|
XmlValue(int type,
java.lang.String v)
Construct a typed value from a string.
|
XmlValue(java.lang.String v)
Construct a value from a string.
|
XmlValue(java.lang.String typeURI,
java.lang.String typeName,
java.lang.String v)
Construct a typed value, where the type is defined by a URI and name, from a string.
|
XmlValue(XmlDocument document)
Construct a value from a document.
|
XmlValue(XmlValue other)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
asBinary()
Returns the value as a byte array.
|
boolean |
asBoolean()
Returns the value as a
BOOLEAN. |
XmlDocument |
asDocument()
Returns the value as an
XmlDocument. |
XmlEventReader |
asEventReader()
Returns the value as an
XmlEventReader. |
double |
asNumber()
Returns the value as a
DOUBLE. |
java.lang.String |
asString()
Returns the value as a
STRING. |
boolean |
equals(XmlValue value)
Determines if two
XmlValue objects represent the same value. |
XmlResults |
getAttributes()
Returns returns a
XmlResults that contains all of the attributes
appearing on this node. |
XmlValue |
getFirstChild()
Returns current node's first child node.
|
XmlValue |
getLastChild()
Returns current node's last child node.
|
java.lang.String |
getLocalName()
Returns the node's local name.
|
java.lang.String |
getNamespaceURI()
Returns the URI used for the node's namespace.
|
XmlValue |
getNextSibling()
Returns the sibling node immediately following this node in the
document.
|
java.lang.String |
getNodeHandle()
Returns a String handle that can be used to directly reference
nodes within a document by using
XmlContainer.getNode(java.lang.String) |
java.lang.String |
getNodeName()
Returns the name of the node contained in this XmlValue.
|
short |
getNodeType()
Returns the short value for this node's node type (e.g.
|
java.lang.String |
getNodeValue()
Returns the node's value.
|
XmlValue |
getOwnerElement()
If the current node is an attribute node, returns the document element
node that contains this attribute node.
|
XmlValue |
getParentNode()
Returns current node's parent.
|
java.lang.String |
getPrefix()
Returns the prefix set for the node's namespace.
|
XmlValue |
getPreviousSibling()
Returns the sibling node immediately preceding this node in the
document.
|
XmlResults |
getResults()
Returns the
XmlResults that is associated with this XmlValue, or null if there is none. |
int |
getType()
|
java.lang.String |
getTypeName()
Returns the type name of the
XmlValue |
java.lang.String |
getTypeURI()
Returns the type URI of the
XmlValue |
boolean |
isBoolean()
|
boolean |
isNode()
|
boolean |
isNull()
|
boolean |
isNumber()
|
boolean |
isString()
|
boolean |
isType(int type)
Indicates whether the
XmlValue is of the specified type. |
static void |
setValue(XmlValue to,
XmlValue from)
Assigns a new value to an existing one.
|
public static final int ELEMENT_NODE
getNodeType().public static final int ATTRIBUTE_NODE
getNodeType().public static final int TEXT_NODE
getNodeType().public static final int CDATA_SECTION_NODE
getNodeType().public static final int ENTITY_REFERENCE_NODE
getNodeType().public static final int ENTITY_NODE
getNodeType().public static final int PROCESSING_INSTRUCTION_NODE
getNodeType().public static final int COMMENT_NODE
getNodeType().public static final int DOCUMENT_NODE
getNodeType().public static final int DOCUMENT_TYPE_NODE
getNodeType().public static final int DOCUMENT_FRAGMENT_NODE
getNodeType().public static final int NOTATION_NODE
getNodeType().public static final int NONE
public static final int NODE
public static final int ANY_SIMPLE_TYPE
public static final int ANY_URI
public static final int BASE_64_BINARY
public static final int BOOLEAN
public static final int DATE
public static final int DATE_TIME
public static final int DAY_TIME_DURATION
public static final int DECIMAL
public static final int DOUBLE
public static final int DURATION
public static final int FLOAT
public static final int G_DAY
public static final int G_MONTH
public static final int G_MONTH_DAY
public static final int G_YEAR
public static final int G_YEAR_MONTH
public static final int HEX_BINARY
public static final int NOTATION
public static final int QNAME
public static final int STRING
public static final int TIME
public static final int YEAR_MONTH_DURATION
public static final int UNTYPED_ATOMIC
public XmlValue()
throws XmlException
XmlExceptionpublic XmlValue(XmlValue other) throws XmlException
XmlExceptionpublic XmlValue(java.lang.String v)
throws XmlException
XmlExceptionpublic XmlValue(double v)
throws XmlException
XmlExceptionpublic XmlValue(boolean v)
throws XmlException
XmlExceptionpublic XmlValue(XmlDocument document) throws XmlException
XmlExceptionpublic XmlValue(int type,
java.lang.String v)
throws XmlException
XmlExceptionpublic XmlValue(java.lang.String typeURI,
java.lang.String typeName,
java.lang.String v)
throws XmlException
XmlExceptionpublic XmlValue(int type,
byte[] dbt)
throws XmlException
XmlExceptionpublic int getType()
throws XmlException
XmlExceptionpublic java.lang.String getTypeURI()
throws XmlException
XmlValueXmlExceptionpublic java.lang.String getTypeName()
throws XmlException
XmlValueXmlExceptionpublic java.lang.String getNodeHandle()
throws XmlException
XmlContainer.getNode(java.lang.String)
If the type of the XmlValue is not NODE, an
exception is thrown.
XmlExceptionpublic boolean isNull()
throws XmlException
XmlExceptionpublic boolean isType(int type)
throws XmlException
XmlValue is of the specified type.XmlExceptionpublic boolean isNumber()
throws XmlException
XmlExceptionpublic boolean isString()
throws XmlException
XmlExceptionpublic boolean isBoolean()
throws XmlException
XmlExceptionpublic boolean isNode()
throws XmlException
XmlExceptionpublic byte[] asBinary()
throws XmlException
XmlExceptionpublic double asNumber()
throws XmlException
DOUBLE.XmlExceptionpublic java.lang.String asString()
throws XmlException
STRING.XmlExceptionpublic boolean asBoolean()
throws XmlException
BOOLEAN.XmlExceptionpublic XmlDocument asDocument() throws XmlException
XmlDocument.XmlExceptionpublic XmlEventReader asEventReader() throws XmlException
XmlEventReader. This operation is
only valid if the XmlValue is of type NODE. The ownership of the
XmlEventReader belongs to the caller, and its resources must
be released using XmlEventReader.close().XmlExceptionpublic boolean equals(XmlValue value) throws XmlException
XmlValue objects represent the same value. It returns
true if the two XmlValue objects represent the same value.XmlExceptionpublic java.lang.String getNodeName()
throws XmlException
NODE, an XmlException is thrown.XmlExceptionpublic java.lang.String getNodeValue()
throws XmlException
NODE, an XmlException is thrown.XmlExceptionpublic java.lang.String getNamespaceURI()
throws XmlException
NODE, an XmlException is thrown.XmlExceptionpublic java.lang.String getPrefix()
throws XmlException
NODE, an XmlException is thrown.XmlExceptionpublic java.lang.String getLocalName()
throws XmlException
NODE, an XmlException is thrown.XmlExceptionpublic short getNodeType()
throws XmlException
ELEMENT_NODE)
If the node type is not NODE, an XmlException
is thrown.XmlExceptionpublic XmlValue getParentNode() throws XmlException
NONE is
returned. If the node type is not NODE, an
XmlException is thrown.
This function cannot be used on values that were created from an
XmlDocument that was created using XmlManager.createDocument()
and never placed in a container, an XmlException is thrown if this
happens.XmlExceptionpublic XmlValue getFirstChild() throws XmlException
NONE
is returned. If the node type is not NODE, an
XmlException is thrown.
This function cannot be used on values that were created from an
XmlDocument that was created using
XmlManager.createDocument()
and never placed in a container, an XmlException is thrown if this
happens.XmlExceptionpublic XmlValue getLastChild() throws XmlException
NONE is returned.
If the node type is not NODE, an XmlException
is thrown.
This function cannot be used on values that were created from an
XmlDocument that was created using
XmlManager.createDocument()
and never placed in a container, an XmlException is thrown if this
happens.XmlExceptionpublic XmlValue getPreviousSibling() throws XmlException
NONE is returned.
If the node type is not NODE, an XmlException
is thrown.
This function cannot be used on values that were created from an
XmlDocument that was created using
XmlManager.createDocument()
and never placed in a container, an XmlException is thrown if this
happens.XmlExceptionpublic XmlValue getNextSibling() throws XmlException
NONE is returned.
If the node type is not NODE, an
XmlException is thrown.
This function cannot be used on values that were created from an
XmlDocument that was created using
XmlManager.createDocument()
and never placed in a container, an XmlException is thrown if this
happens.XmlExceptionpublic XmlResults getAttributes() throws XmlException
XmlResults that contains all of the attributes
appearing on this node. If the node type is not NODE, an
XmlException is thrown.
This function cannot be used on values that were created from an
XmlDocument that was created using
XmlManager.createDocument()
and never placed in a container, anXmlException is thrown if this
happens.XmlExceptionpublic XmlValue getOwnerElement() throws XmlException
XmlException is thrown.
This function cannot be used on values that were created from an
XmlDocument that was created using
XmlManager.createDocument()
and never placed in a container, an XmlException is thrown if this
happens.XmlExceptionpublic static void setValue(XmlValue to, XmlValue from) throws XmlException
to - The value to be overwritten.from - The value to copy.XmlExceptionpublic XmlResults getResults()
XmlResults that is associated with this XmlValue, or null if there is none. This function exists to make it easier to call XmlResults.delete() when the value is no longer needed.Copyright (c) 2004,2014 Oracle. All rights reserved.