|
Berkeley DB XML version 2.5.16 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sleepycat.dbxml.XmlValue
public class 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 class constants. 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 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.
Field Summary | |
---|---|
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 Summary | |
---|---|
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,
String v)
Construct a typed value from a string. |
|
XmlValue(String v)
Construct a value from a string. |
|
XmlValue(String typeURI,
String typeName,
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. |
Method Summary | |
---|---|
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 . |
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. |
String |
getLocalName()
Returns the node's local name. |
String |
getNamespaceURI()
Returns the URI used for the node's namespace. |
XmlValue |
getNextSibling()
Returns the sibling node immediately following this node in the document. |
String |
getNodeHandle()
Returns a String handle that can be used to directly reference nodes within a document by using XmlContainer.getNode(java.lang.String) |
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. |
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. |
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()
Returns the type of the XmlValue , which will be one of the XmlValue class constants. |
String |
getTypeName()
Returns the type name of the XmlValue |
String |
getTypeURI()
Returns the type URI of the XmlValue |
boolean |
isBoolean()
Returns true if the XmlValue is one of type BOOLEAN . |
boolean |
isNode()
Returns true if the XmlValue is of type NODE . |
boolean |
isNull()
Returns true if the XmlValue has no value (type NONE ). |
boolean |
isNumber()
Returns true if the XmlValue is one of the numeric types,
such as DOUBLE , FLOAT , etc. |
boolean |
isString()
Returns true if the XmlValue is one of type STRING . |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public XmlValue() throws XmlException
XmlException
public XmlValue(XmlValue other) throws XmlException
XmlException
public XmlValue(String v) throws XmlException
XmlException
public XmlValue(double v) throws XmlException
XmlException
public XmlValue(boolean v) throws XmlException
XmlException
public XmlValue(XmlDocument document) throws XmlException
XmlException
public XmlValue(int type, String v) throws XmlException
XmlException
public XmlValue(String typeURI, String typeName, String v) throws XmlException
XmlException
public XmlValue(int type, byte[] dbt) throws XmlException
XmlException
Method Detail |
---|
public int getType() throws XmlException
XmlValue
, which will be one of the XmlValue
class constants.
XmlException
public String getTypeURI() throws XmlException
XmlValue
XmlException
public String getTypeName() throws XmlException
XmlValue
XmlException
public String getNodeHandle() throws XmlException
XmlContainer.getNode(java.lang.String)
If the type of the XmlValue
is not NODE
, an
exception is thrown.
XmlException
public boolean isNull() throws XmlException
XmlValue
has no value (type NONE
).
XmlException
public boolean isType(int type) throws XmlException
XmlValue
is of the specified type.
XmlException
public boolean isNumber() throws XmlException
XmlValue
is one of the numeric types,
such as DOUBLE
, FLOAT
, etc.
XmlException
public boolean isString() throws XmlException
XmlValue
is one of type STRING
.
XmlException
public boolean isBoolean() throws XmlException
XmlValue
is one of type BOOLEAN
.
XmlException
public boolean isNode() throws XmlException
XmlValue
is of type NODE
.
XmlException
public byte[] asBinary() throws XmlException
XmlException
public double asNumber() throws XmlException
DOUBLE
.
XmlException
public String asString() throws XmlException
STRING
.
XmlException
public boolean asBoolean() throws XmlException
BOOLEAN
.
XmlException
public XmlDocument asDocument() throws XmlException
XmlDocument
.
XmlException
public 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()
.
XmlException
public boolean equals(XmlValue value) throws XmlException
XmlValue
objects represent the same value. It returns
true if the two XmlValue
objects represent the same value.
XmlException
public String getNodeName() throws XmlException
NODE
, an XmlException
is thrown.
XmlException
public String getNodeValue() throws XmlException
NODE
, an XmlException
is thrown.
XmlException
public String getNamespaceURI() throws XmlException
NODE
, an XmlException
is thrown.
XmlException
public String getPrefix() throws XmlException
NODE
, an XmlException
is thrown.
XmlException
public String getLocalName() throws XmlException
NODE
, an XmlException
is thrown.
XmlException
public short getNodeType() throws XmlException
ELEMENT_NODE
)
If the node type is not NODE
, an XmlException
is thrown.
XmlException
public 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.
XmlException
public 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.
XmlException
public 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.
XmlException
public 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.
XmlException
public 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.
XmlException
public 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.
XmlException
public 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.
XmlException
public static void setValue(XmlValue to, XmlValue from) throws XmlException
to
- The value to be overwritten.from
- The value to copy.
XmlException
public 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.
|
Berkeley DB XML version 2.5.16 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |