Spring Web Services Framework

org.springframework.xml.xpath
Class Jaxp13XPathTemplate

java.lang.Object
  extended by org.springframework.xml.transform.TransformerObjectSupport
      extended by org.springframework.xml.xpath.AbstractXPathTemplate
          extended by org.springframework.xml.xpath.Jaxp13XPathTemplate
All Implemented Interfaces:
XPathOperations

public class Jaxp13XPathTemplate
extends AbstractXPathTemplate

Implementation of XPathOperations that uses JAXP 1.3. JAXP 1.3 is part of Java SE since 1.5.

Namespaces can be set using the namespaces property.

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
AbstractXPathTemplate.setNamespaces(java.util.Properties)

Field Summary
 
Fields inherited from class org.springframework.xml.transform.TransformerObjectSupport
logger
 
Constructor Summary
Jaxp13XPathTemplate()
           
Jaxp13XPathTemplate(String xpathFactoryUri)
           
 
Method Summary
 List evaluate(String expression, Source context, NodeMapper nodeMapper)
          Evaluates the given expression, mapping each result Node objects to a Java object via a NodeMapper.
 boolean evaluateAsBoolean(String expression, Source context)
          Evaluates the given expression as a boolean.
 double evaluateAsDouble(String expression, Source context)
          Evaluates the given expression as a double.
 Node evaluateAsNode(String expression, Source context)
          Evaluates the given expression as a Node.
 List evaluateAsNodeList(String expression, Source context)
          Evaluates the given expression as a list of Node objects.
 Object evaluateAsObject(String expression, Source context, NodeMapper nodeMapper)
          Evaluates the given expression, mapping a single Node result to a Java object via a NodeMapper.
 String evaluateAsString(String expression, Source context)
          Evaluates the given expression as a String.
 
Methods inherited from class org.springframework.xml.xpath.AbstractXPathTemplate
evaluate, getNamespaces, getRootElement, setNamespaces
 
Methods inherited from class org.springframework.xml.transform.TransformerObjectSupport
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jaxp13XPathTemplate

public Jaxp13XPathTemplate()

Jaxp13XPathTemplate

public Jaxp13XPathTemplate(String xpathFactoryUri)
Method Detail

evaluateAsBoolean

public boolean evaluateAsBoolean(String expression,
                                 Source context)
                          throws XPathException
Description copied from interface: XPathOperations
Evaluates the given expression as a boolean. Returns the boolean evaluation of the expression, or false if it is invalid.

Parameters:
expression - the XPath expression
context - the context starting point
Returns:
the result of the evaluation
Throws:
XPathException - in case of XPath errors
See Also:
XPath specification

evaluateAsNode

public Node evaluateAsNode(String expression,
                           Source context)
                    throws XPathException
Description copied from interface: XPathOperations
Evaluates the given expression as a Node. Returns the evaluation of the expression, or null if it is invalid.

Parameters:
expression - the XPath expression
context - the context starting point
Returns:
the result of the evaluation
Throws:
XPathException - in case of XPath errors
See Also:
XPath specification

evaluateAsNodeList

public List evaluateAsNodeList(String expression,
                               Source context)
                        throws XPathException
Description copied from interface: XPathOperations
Evaluates the given expression as a list of Node objects. Returns the evaluation of the expression, or an empty list if no results are found.

Parameters:
expression - the XPath expression
context - the context starting point
Returns:
the result of the evaluation
Throws:
XPathException - in case of XPath errors
See Also:
XPath specification

evaluateAsDouble

public double evaluateAsDouble(String expression,
                               Source context)
                        throws XPathException
Description copied from interface: XPathOperations
Evaluates the given expression as a double. Returns the evaluation of the expression, or Double.NaN if it is invalid.

Parameters:
expression - the XPath expression
context - the context starting point
Returns:
the result of the evaluation
Throws:
XPathException - in case of XPath errors
See Also:
XPath specification

evaluateAsString

public String evaluateAsString(String expression,
                               Source context)
                        throws XPathException
Description copied from interface: XPathOperations
Evaluates the given expression as a String. Returns the evaluation of the expression, or null if it is invalid.

Parameters:
expression - the XPath expression
context - the context starting point
Returns:
the result of the evaluation
Throws:
XPathException - in case of XPath errors
See Also:
XPath specification

evaluateAsObject

public Object evaluateAsObject(String expression,
                               Source context,
                               NodeMapper nodeMapper)
                        throws XPathException
Description copied from interface: XPathOperations
Evaluates the given expression, mapping a single Node result to a Java object via a NodeMapper.

Parameters:
expression - the XPath expression
context - the context starting point
nodeMapper - object that will map one object per node
Returns:
the single mapped object
Throws:
XPathException - in case of XPath errors
See Also:
XPath specification

evaluate

public List evaluate(String expression,
                     Source context,
                     NodeMapper nodeMapper)
              throws XPathException
Description copied from interface: XPathOperations
Evaluates the given expression, mapping each result Node objects to a Java object via a NodeMapper.

Parameters:
expression - the XPath expression
context - the context starting point
nodeMapper - object that will map one object per node
Returns:
the result list, containing mapped objects
Throws:
XPathException - in case of XPath errors
See Also:
XPath specification

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.