org.inria.ns.reflex.xml.xpath
Interface XPath

All Superinterfaces:
CompiledExpression
All Known Implementing Classes:
JaxenXPath

public interface XPath
extends CompiledExpression

Defines a compiled XPath expression ready to use.

Author:
Philippe Poulard
See Also:
XFactory.parseXPath(String)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.xml.CompiledExpression
CompiledExpression.Impl
 
Method Summary
 boolean booleanValueOf(XPathContext context)
          Retrieve a boolean-value interpretation of this XPath expression when evaluated against a given context.
 Number numberValueOf(XPathContext context)
          Retrieve a number-value interpretation of this XPath expression when evaluated against a given context.
 List selectNodes(XPathContext context)
          Select all nodes that are selectable by this XPath expression.
 Object selectSingleNode(XPathContext context)
          Select only the first node that is selectable by this XPath expression.
 String stringValueOf(XPathContext context)
          Retrieve a string-value interpretation of this XPath expression when evaluated against a given context.
 
Methods inherited from interface org.inria.ns.reflex.xml.CompiledExpression
asPattern, evaluate, getXFactory
 

Method Detail

selectNodes

List selectNodes(XPathContext context)
                 throws XPathException
Select all nodes that are selectable by this XPath expression. If multiple nodes match, multiple nodes will be returned.

NOTE: In most cases, nodes will be returned in document-order, as defined by the XML Canonicalization specification. The exception occurs when using XPath expressions involving the union operator (denoted with the pipe '|' character).

Parameters:
context - is the Context which gets evaluated.
Returns:
The node-set of all items selected by this XPath expression.
Throws:
XPathException
See Also:
selectSingleNode(org.inria.ns.reflex.xml.xpath.XPathContext)

selectSingleNode

Object selectSingleNode(XPathContext context)
                        throws XPathException
Select only the first node that is selectable by this XPath expression. If multiple nodes match, only one node will be returned. NOTE: In most cases, the selected node will be the first selectable node in document-order, as defined by the XML Canonicalization specification. The exception occurs when using XPath expressions involving the union operator (denoted with the pipe '|' character).

Parameters:
context - is the Context which gets evaluated.
Returns:
The node-set of all items selected by this XPath expression.
Throws:
XPathException
See Also:
selectNodes(org.inria.ns.reflex.xml.xpath.XPathContext)

stringValueOf

String stringValueOf(XPathContext context)
                     throws XPathException
Retrieve a string-value interpretation of this XPath expression when evaluated against a given context.

The string-value of the expression is determined per the string(..) core function as defined in the XPath specification. This means that an expression that selects more than one nodes will return the string value of the first node in the node set..

Parameters:
context - is the Context which gets evaluated.
Returns:
The string-value interpretation of this expression.
Throws:
XPathException

booleanValueOf

boolean booleanValueOf(XPathContext context)
                       throws XPathException
Retrieve a boolean-value interpretation of this XPath expression when evaluated against a given context.

The boolean-value of the expression is determined per the boolean(..) core function as defined in the XPath specification. This means that an expression that selects zero nodes will return false, while an expression that selects one-or-more nodes will return true.

Parameters:
context - is the Context which gets evaluated.
Returns:
The boolean-value interpretation of this expression.
Throws:
XPathException

numberValueOf

Number numberValueOf(XPathContext context)
                     throws XPathException
Retrieve a number-value interpretation of this XPath expression when evaluated against a given context.

The number-value of the expression is determined per the number(..) core function as defined in the XPath specification. This means that if this expression selects multiple nodes, the number-value of the first node is returned.

Parameters:
context - is the Context which gets evaluated.
Returns:
The number-value interpretation of this expression.
Throws:
XPathException