org.exolab.adaptx.xpath

Class XPathResult

Implemented Interfaces:
java.io.Serializable
Known Direct Subclasses:
BooleanResult, NodeSet, NumberResult, StringResult, XSLTFunctionResult

public abstract class XPathResult
extends java.lang.Object
implements java.io.Serializable

Abstract class representing the result of an XPath expression. An XPath result can be one of the following four types:

Version:
$Revision: 1.1.1.1 $

Authors:
Keith Visco
Assaf Arkin

See Also:
Serialized Form

Field Summary

static int
BOOLEAN
An XPath result of type boolean.
static int
NODE_SET
An XPath result of type node-set.
static int
NUMBER
An XPath result of type number.
static int
STRING
An XPath result of type string.
static int
USER_DEFINED
An XPath result used for XPath extensions

Method Summary

boolean
booleanValue()
Returns the result as a boolean value.
boolean
equals(XPathResult result)
Returns true if the given expression is the same tyoe as this result and has the same value as this result.
int
getResultType()
Returns the type of this result.
Object
javaObject()
Returns the result as a Java object.
double
numberValue()
Returns the result as a number value.
String
stringValue()
Returns the result as a string value.

Field Details

BOOLEAN

public static final int BOOLEAN

Field Value:
0


NODE_SET

public static final int NODE_SET

Field Value:
3


NUMBER

public static final int NUMBER

Field Value:
1


STRING

public static final int STRING

Field Value:
2


USER_DEFINED

public static final int USER_DEFINED
An XPath result used for XPath extensions

Field Value:
4

Method Details

booleanValue

public boolean booleanValue()
Returns the result as a boolean value. Returns the value of a boolean result, true for a non-empty string result, true for a non-zero number result, and true from a non-empty node-set.

Returns:
The result as a boolean value


equals

public boolean equals(XPathResult result)
Returns true if the given expression is the same tyoe as this result and has the same value as this result.

Parameters:
result - An XPath result

Returns:
True if same type and same value as this result


getResultType

public int getResultType()
Returns the type of this result.

Returns:
The type of this result


javaObject

public Object javaObject()

Returns:
The result as a Java object


numberValue

public double numberValue()
Returns the result as a number value. Returns 0 or 1 for a boolean result, the parsed value for a string result, the value of a number result, or the parsed value of a node-set.

Returns:
The result as a number value


stringValue

public String stringValue()
Returns the result as a string value. Returns "false" or "true" for a boolean result, the value of a string result, the string value of a number result, or the string value of a node-set.

Returns:
The result as a string value