gnu.xml.xpath

Class Expr

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

public abstract class Expr
extends 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.
abstract Expr
clone(Object context)
String
evaluate(Object item)
Object
evaluate(Object item, QName returnType)
abstract Object
evaluate(Node context, int pos, int len)
String
evaluate(InputSource source)
Object
evaluate(InputSource source, QName returnType)
abstract boolean
references(QName var)
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.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

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 abstract 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 abstract 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

references

public abstract boolean references(QName var)

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.

Expr.java -- Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.