Spring Web Services Framework

org.springframework.xml.xpath
Class XPathExpressionFactory

java.lang.Object
  extended by org.springframework.xml.xpath.XPathExpressionFactory

public abstract class XPathExpressionFactory
extends Object

Factory for compiled XPathExpressions, being aware of JAXP 1.3+ XPath functionality, and Jaxen. Mainly for internal use of the framework.

The goal of this class is to avoid runtime dependencies a specific XPath engine, simply using the best XPath implementation that is available. Prefers JAXP 1.3+ XPath implementations to Jaxen.

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
XPathExpression

Constructor Summary
XPathExpressionFactory()
           
 
Method Summary
static XPathExpression createXPathExpression(String expression)
          Create a compiled XPath expression using the given string.
static XPathExpression createXPathExpression(String expression, Map namespaces)
          Create a compiled XPath expression using the given string and namespaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathExpressionFactory

public XPathExpressionFactory()
Method Detail

createXPathExpression

public static XPathExpression createXPathExpression(String expression)
                                             throws IllegalStateException,
                                                    XPathParseException
Create a compiled XPath expression using the given string.

Parameters:
expression - the XPath expression
Returns:
the compiled XPath expression
Throws:
IllegalStateException - if neither JAXP 1.3+, or Jaxen are available
XPathParseException - if the given expression cannot be parsed

createXPathExpression

public static XPathExpression createXPathExpression(String expression,
                                                    Map namespaces)
                                             throws IllegalStateException,
                                                    XPathParseException
Create a compiled XPath expression using the given string and namespaces. The namespace map should consist of string prefixes mapped to string namespaces.

Parameters:
expression - the XPath expression
namespaces - a map that binds string prefixes to string namespaces
Returns:
the compiled XPath expression
Throws:
IllegalStateException - if neither JAXP 1.3+, or Jaxen are available
XPathParseException - if the given expression cannot be parsed

Spring Web Services Framework

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