gnu.xml.xpath

Class Expr

Implemented Interfaces:
XPathExpression
Known Direct Subclasses:
AndExpr, Constant, FunctionCall, OrExpr, Pattern, VariableReference

public abstract class Expr
extends java.lang.Object
implements XPathExpression

An XPath expression. This can be evaluated in the context of a node to produce a result.

Field Summary

protected static DecimalFormat
decimalFormat
protected static Comparator
documentOrderComparator

Method Summary

static boolean
_boolean(Node context, Object object)
Implementation of the XPath boolean function.
static Collection
_id(Node context, Object object)
The id function selects elements by their unique ID.
static String
_local_name(Node context, Collection nodeSet)
The local-name function returns the local part of the expanded-name of the node in the argument node-set that is first in document order.
static String
_name(Node context, Collection nodeSet)
The name function returns a string containing a QName representing the expanded-name of the node in the argument node-set that is first in document order.
static String
_namespace_uri(Node context, Collection nodeSet)
The namespace-uri function returns the namespace URI of the expanded-name of the node in the argument node-set that is first in document order.
static double
_number(Node context, Object object)
Implementation of the XPath number function.
static String
_string(Node context, Object object)
Implementation of the XPath string function.
Expr
clone(Object context)
String
evaluate(Object item)
Object
evaluate(Object item, QName returnType)
Object
evaluate(Node context, int pos, int len)
String
evaluate(InputSource source)
Object
evaluate(InputSource source, QName returnType)
static String
stringValue(Collection nodeSet)
Computes the XPath string-value of the specified node-set.
static String
stringValue(Node node)
Computes the XPath string-value of the specified node.

Field Details

decimalFormat

protected static final DecimalFormat decimalFormat


documentOrderComparator

protected static final Comparator documentOrderComparator

Method Details

_boolean

public static boolean _boolean(Node context,
                               Object object)
Implementation of the XPath boolean function.


_id

public static Collection _id(Node context,
                             Object object)
The id function selects elements by their unique ID. When the argument to id is of type node-set, then the result is the union of the result of applying id to the string-value of each of the nodes in the argument node-set. When the argument to id is of any other type, the argument is converted to a string as if by a call to the string function; the string is split into a whitespace-separated list of tokens (whitespace is any sequence of characters matching the production S); the result is a node-set containing the elements in the same document as the context node that have a unique ID equal to any of the tokens in the list.


_local_name

public static String _local_name(Node context,
                                 Collection nodeSet)
The local-name function returns the local part of the expanded-name of the node in the argument node-set that is first in document order. If the argument node-set is empty or the first node has no expanded-name, an empty string is returned. If the argument is omitted, it defaults to a node-set with the context node as its only member.


_name

public static String _name(Node context,
                           Collection nodeSet)
The name function returns a string containing a QName representing the expanded-name of the node in the argument node-set that is first in document order. The QName must represent the expanded-name with respect to the namespace declarations in effect on the node whose expanded-name is being represented. Typically, this will be the QName that occurred in the XML source. This need not be the case if there are namespace declarations in effect on the node that associate multiple prefixes with the same namespace. However, an implementation may include information about the original prefix in its representation of nodes; in this case, an implementation can ensure that the returned string is always the same as the QName used in the XML source. If the argument node-set is empty or the first node has no expanded-name, an empty string is returned. If the argument it omitted, it defaults to a node-set with the context node as its only member.


_namespace_uri

public static String _namespace_uri(Node context,
                                    Collection nodeSet)
The namespace-uri function returns the namespace URI of the expanded-name of the node in the argument node-set that is first in document order. If the argument node-set is empty, the first node has no expanded-name, or the namespace URI of the expanded-name is null, an empty string is returned. If the argument is omitted, it defaults to a node-set with the context node as its only member.


_number

public static double _number(Node context,
                             Object object)
Implementation of the XPath number function.


_string

public static String _string(Node context,
                             Object object)
Implementation of the XPath string function.


clone

public Expr clone(Object context)


evaluate

public String evaluate(Object item)
            throws XPathExpressionException
Specified by:
evaluate in interface XPathExpression


evaluate

public Object evaluate(Object item,
                       QName returnType)
            throws XPathExpressionException
Specified by:
evaluate in interface XPathExpression


evaluate

public Object evaluate(Node context,
                       int pos,
                       int len)


evaluate

public String evaluate(InputSource source)
            throws XPathExpressionException
Specified by:
evaluate in interface XPathExpression


evaluate

public Object evaluate(InputSource source,
                       QName returnType)
            throws XPathExpressionException
Specified by:
evaluate in interface XPathExpression


stringValue

public static String stringValue(Collection nodeSet)
Computes the XPath string-value of the specified node-set.


stringValue

public static String stringValue(Node node)
Computes the XPath string-value of the specified node.