org::jdom::xpath::XPath Class Reference

List of all members.

Public Member Functions

abstract List selectNodes (Object context) throws JDOMException
abstract Object selectSingleNode (Object context) throws JDOMException
abstract String valueOf (Object context) throws JDOMException
abstract Number numberValueOf (Object context) throws JDOMException
abstract void setVariable (String name, Object value)
abstract void addNamespace (Namespace namespace)
void addNamespace (String prefix, String uri)
abstract String getXPath ()

Static Public Member Functions

static XPath newInstance (String path) throws JDOMException
static void setXPathClass (Class aClass) throws JDOMException
static List selectNodes (Object context, String path) throws JDOMException
static Object selectSingleNode (Object context, String path) throws JDOMException

Protected Member Functions

 XPath (String expr) throws JDOMException
final Object writeReplace () throws ObjectStreamException

Classes

class  XPathString

Detailed Description

A JDOM-oriented wrapper around XPath engines.

Author:
Laurent Bihanic
Version:
Revision
1.10
,
Date
2003/04/08 04:57:46


Constructor & Destructor Documentation

org::jdom::xpath::XPath::XPath String  expr  )  throws JDOMException [inline, protected]
 

Creates a new XPath wrapper object, compiling the specified XPath expression.

Parameters:
expr the XPath expression to wrap.
Exceptions:
JDOMException if the XPath expression is invalid.


Member Function Documentation

void org::jdom::xpath::XPath::addNamespace String  prefix,
String  uri
[inline]
 

Adds a namespace definition (prefix and URI) to the list of namespaces known of this XPath expression.

Note: In XPath, there is no such thing as a 'default namespace'. The empty prefix always resolves to the empty namespace URI.

Parameters:
prefix the namespace prefix.
uri the namespace URI.
Exceptions:
IllegalNameException if the prefix or uri are null or empty strings or if they contain illegal characters.

abstract void org::jdom::xpath::XPath::addNamespace Namespace  namespace  )  [pure virtual]
 

Adds a namespace definition to the list of namespaces known of this XPath expression.

Note: In XPath, there is no such thing as a 'default namespace'. The empty prefix always resolves to the empty namespace URI.

Parameters:
namespace the namespace.

abstract String org::jdom::xpath::XPath::getXPath  )  [pure virtual]
 

Returns the wrapped XPath expression as a string.

Returns:
the wrapped XPath expression as a string.

static XPath org::jdom::xpath::XPath::newInstance String  path  )  throws JDOMException [inline, static]
 

Creates a new XPath wrapper object, compiling the specified XPath expression.

Parameters:
path the XPath expression to wrap.
Exceptions:
JDOMException if the XPath expression is invalid.

abstract Number org::jdom::xpath::XPath::numberValueOf Object  context  )  throws JDOMException [pure virtual]
 

Returns the number value of the first node selected by applying the wrapped XPath expression to the given context.

Parameters:
context the element to use as context for evaluating the XPath expression.
Returns:
the number value of the first node selected by applying the wrapped XPath expression to the given context, null if no node was selected or the special value java.lang.Double#NaN (Not-a-Number) if the selected value can not be converted into a number value.
Exceptions:
JDOMException if the XPath expression is invalid or its evaluation on the specified context failed.

static List org::jdom::xpath::XPath::selectNodes Object  context,
String  path
throws JDOMException [inline, static]
 

Evaluates an XPath expression and returns the list of selected nodes.

Note: This method should not be used when the same XPath expression needs to be applied several times (on the same or different contexts) as it requires the expression to be compiled before being evaluated. In such cases, allocating an XPath wrapper instance and evaluating it several times is way more efficient.

Parameters:
context the node to use as context for evaluating the XPath expression.
path the XPath expression to evaluate.
Returns:
the list of selected nodes, which can be instances of the following JDOM classes: org.jdom.Element, org.jdom.Attribute, org.jdom.Text, org.jdom.CDATA, org.jdom.Comment or org.jdom.ProcessingInstruction.
Exceptions:
JDOMException if the XPath expression is invalid or its evaluation on the specified context failed.

abstract List org::jdom::xpath::XPath::selectNodes Object  context  )  throws JDOMException [pure virtual]
 

Evaluates the wrapped XPath expression and returns the list of selected nodes.

Parameters:
context the node to use as context for evaluating the XPath expression.
Returns:
the list of selected nodes, which can be instances of the following JDOM classes: org.jdom.Element, org.jdom.Attribute, org.jdom.Text, org.jdom.CDATA, org.jdom.Comment or org.jdom.ProcessingInstruction.
Exceptions:
JDOMException if the evaluation of the XPath expression on the specified context failed.

static Object org::jdom::xpath::XPath::selectSingleNode Object  context,
String  path
throws JDOMException [inline, static]
 

Evaluates the wrapped XPath expression and returns the first entry in the list of selected nodes.

Note: This method should not be used when the same XPath expression needs to be applied several times (on the same or different contexts) as it requires the expression to be compiled before being evaluated. In such cases, allocating an XPath wrapper instance and evaluating it several times is way more efficient.

Parameters:
context the element to use as context for evaluating the XPath expression.
path the XPath expression to evaluate.
Returns:
the first selected nodes, which is an instance of one of the following JDOM classes: org.jdom.Element, org.jdom.Attribute, org.jdom.Text, org.jdom.CDATA, org.jdom.Comment or org.jdom.ProcessingInstruction or null if no node was selected.
Exceptions:
JDOMException if the XPath expression is invalid or its evaluation on the specified context failed.

abstract Object org::jdom::xpath::XPath::selectSingleNode Object  context  )  throws JDOMException [pure virtual]
 

Evaluates the wrapped XPath expression and returns the first entry in the list of selected nodes.

Parameters:
context the node to use as context for evaluating the XPath expression.
Returns:
the first selected nodes, which is an instance of one of the following JDOM classes: org.jdom.Element, org.jdom.Attribute, org.jdom.Text, org.jdom.CDATA, org.jdom.Comment or org.jdom.ProcessingInstruction or null if no node was selected.
Exceptions:
JDOMException if the evaluation of the XPath expression on the specified context failed.

abstract void org::jdom::xpath::XPath::setVariable String  name,
Object  value
[pure virtual]
 

Defines an XPath variable and sets its value.

Parameters:
name the variable name.
value the variable value.
Exceptions:
IllegalArgumentException if name is not a valid XPath variable name or if the value type is not supported by the underlying implementation

static void org::jdom::xpath::XPath::setXPathClass Class  aClass  )  throws JDOMException [inline, static]
 

Sets the concrete XPath subclass to use when allocating XPath instances.

Parameters:
aClass the concrete subclass of XPath.
Exceptions:
IllegalArgumentException if aClass is null.
JDOMException if aClass is not a concrete subclass of XPath.

abstract String org::jdom::xpath::XPath::valueOf Object  context  )  throws JDOMException [pure virtual]
 

Returns the string value of the first node selected by applying the wrapped XPath expression to the given context.

Parameters:
context the element to use as context for evaluating the XPath expression.
Returns:
the string value of the first node selected by applying the wrapped XPath expression to the given context.
Exceptions:
JDOMException if the XPath expression is invalid or its evaluation on the specified context failed.

final Object org::jdom::xpath::XPath::writeReplace  )  throws ObjectStreamException [inline, protected]
 

[Serialization support] Returns the alternative object to write to the stream when serializing this object. This method returns an instance of a dedicated nested class to serialize XPath expressions independently of the concrete implementation being used.

Note: Subclasses are not allowed to override this method to ensure valid serialization of all implementations.

Returns:
an XPathString instance configured with the wrapped XPath expression.
Exceptions:
ObjectStreamException never.


The documentation for this class was generated from the following file:
Generated on Tue Jan 17 02:53:57 2006 for JDOM by  doxygen 1.4.6