Class XPathResult
java.lang.Object
org.libxmq.imp.xml.XPathResult
The value of an xpath evaluation, like XmlXPathResult in the C version: a node set
(possibly a result tree fragment), a boolean, a number or a string. Values are also
created by the caller, eg variable values and extension function results.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a node to a node set.booleanThe boolean of a BOOLEAN value.booleanConvert to a boolean like xpath boolean().doubleConvert to a number like xpath number().Convert to a string like xpath string() (a node set gives the string value of its first node).copy()A copy of this value.booleanisTree()True if this is a node set that is a result tree fragment.static XPathResultnewBoolean(boolean b) A boolean value.static XPathResultAn empty node set.static XPathResultnewNumber(double d) A number value.static XPathResultA string value.node(int i) A node of a node set.nodes()The nodes of a node set, the list may be changed by the caller.doubleThe number of a NUMBER value.voidsetTree(boolean tree) Mark a node set as a result tree fragment.intsize()The number of nodes of a node set.The string of a STRING value.inttype()The type: NODESET, BOOLEAN, NUMBER or STRING.
-
Field Details
-
NODESET
public static final int NODESETA node set.- See Also:
-
BOOLEAN
public static final int BOOLEANA boolean.- See Also:
-
NUMBER
public static final int NUMBERA number.- See Also:
-
STRING
public static final int STRINGA string.- See Also:
-
-
Method Details
-
newString
A string value.- Parameters:
s- The string, null is "".- Returns:
- The value.
-
newNumber
A number value.- Parameters:
d- The number.- Returns:
- The value.
-
newBoolean
A boolean value.- Parameters:
b- The boolean.- Returns:
- The value.
-
newNodeSet
-
addNode
-
setTree
public void setTree(boolean tree) Mark a node set as a result tree fragment. Copies keep the mark.- Parameters:
tree- True for a result tree fragment.
-
isTree
public boolean isTree()True if this is a node set that is a result tree fragment.- Returns:
- True for a result tree fragment.
-
copy
-
type
public int type()The type: NODESET, BOOLEAN, NUMBER or STRING.- Returns:
- The type.
-
size
public int size()The number of nodes of a node set.- Returns:
- The size.
-
node
A node of a node set.- Parameters:
i- The index.- Returns:
- The node or null.
-
nodes
-
booleanValue
public boolean booleanValue()The boolean of a BOOLEAN value.- Returns:
- The boolean.
-
numberValue
public double numberValue()The number of a NUMBER value.- Returns:
- The number.
-
stringValue
-
castToString
Convert to a string like xpath string() (a node set gives the string value of its first node).- Returns:
- The string.
-
castToNumber
public double castToNumber()Convert to a number like xpath number().- Returns:
- The number.
-
castToBoolean
public boolean castToBoolean()Convert to a boolean like xpath boolean().- Returns:
- The boolean.
-