Class JaxenXPathExecuter
- java.lang.Object
-
- net.sf.jasperreports.engine.util.xml.JaxenXPathExecuter
-
- All Implemented Interfaces:
JRXPathExecuter
- Direct Known Subclasses:
JaxenNsAwareXPathExecuter
public class JaxenXPathExecuter extends Object implements JRXPathExecuter
XPath executer implementation that uses Jaxen.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classJaxenXPathExecuter.NodeListWrapper
-
Field Summary
Fields Modifier and Type Field Description static StringEXCEPTION_MESSAGE_KEY_XPATH_COMPILATION_FAILUREstatic StringEXCEPTION_MESSAGE_KEY_XPATH_SELECTION_FAILURE
-
Constructor Summary
Constructors Constructor Description JaxenXPathExecuter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.jaxen.XPathgetXPath(String expression)NodeListselectNodeList(Node contextNode, String expression)Selects a node list by evaluating an XPath expression on a context node.ObjectselectObject(Node contextNode, String expression)Selects an object by evaluating an XPath expression on a context node.
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_XPATH_COMPILATION_FAILURE
public static final String EXCEPTION_MESSAGE_KEY_XPATH_COMPILATION_FAILURE
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_XPATH_SELECTION_FAILURE
public static final String EXCEPTION_MESSAGE_KEY_XPATH_SELECTION_FAILURE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getXPath
protected org.jaxen.XPath getXPath(String expression) throws JRException
- Throws:
JRException
-
selectNodeList
public NodeList selectNodeList(Node contextNode, String expression) throws JRException
Description copied from interface:JRXPathExecuterSelects a node list by evaluating an XPath expression on a context node.- Specified by:
selectNodeListin interfaceJRXPathExecuter- Parameters:
contextNode- the context node (a document can also be used)expression- the XPath expression- Returns:
- the selected node list
- Throws:
JRException- if the XPath evaluation failed
-
selectObject
public Object selectObject(Node contextNode, String expression) throws JRException
Description copied from interface:JRXPathExecuterSelects an object by evaluating an XPath expression on a context node. If the expression evaluates to a node list, the first node in the list should be returned. Otherwise, the primitive value resulted from the evaluation should be returned as ajava.lang.String,java.lang.Numberorjava.lang.Boolean.- Specified by:
selectObjectin interfaceJRXPathExecuter- Parameters:
contextNode- the context node (a document can also be used)expression- the XPath expression- Returns:
- the selected node or value
- Throws:
JRException- if the XPath evaluation failed
-
-