Package net.sf.jasperreports.xalan.util
Class XalanNsAwareXPathExecuter
- java.lang.Object
-
- net.sf.jasperreports.xalan.util.XalanXPathExecuter
-
- net.sf.jasperreports.xalan.util.XalanNsAwareXPathExecuter
-
- All Implemented Interfaces:
JRXPathExecuter
public class XalanNsAwareXPathExecuter extends XalanXPathExecuter
XPath executer implementation that uses Apache Xalan.- Author:
- Narcis Marcu (narcism@users.sourceforge.net)
-
-
Field Summary
-
Fields inherited from class net.sf.jasperreports.xalan.util.XalanXPathExecuter
EXCEPTION_MESSAGE_KEY_XPATH_SELECTION_FAILURE
-
-
Constructor Summary
Constructors Constructor Description XalanNsAwareXPathExecuter()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
containsPrefixes(String expression)
protected void
createNamespaceElement(Node contextNode, String expression)
Map<String,String>
extractXmlNamespaces(Node contextNode)
boolean
getDetectXmlNamespaces()
Map<String,String>
getXmlNamespaceMap()
NodeList
selectNodeList(Node contextNode, String expression)
Selects a node list by evaluating an XPath expression on a context node.Object
selectObject(Node contextNode, String expression)
Selects an object by evaluating an XPath expression on a context node.void
setDetectXmlNamespaces(boolean detectXmlNamespaces)
void
setXmlNamespaceMap(Map<String,String> xmlNamespaceMap)
-
-
-
Method Detail
-
setXmlNamespaceMap
public void setXmlNamespaceMap(Map<String,String> xmlNamespaceMap) throws JRException
- Throws:
JRException
-
getDetectXmlNamespaces
public boolean getDetectXmlNamespaces()
-
setDetectXmlNamespaces
public void setDetectXmlNamespaces(boolean detectXmlNamespaces)
-
createNamespaceElement
protected void createNamespaceElement(Node contextNode, String expression) throws JRException
- Throws:
JRException
-
selectNodeList
public NodeList selectNodeList(Node contextNode, String expression) throws JRException
Description copied from interface:JRXPathExecuter
Selects a node list by evaluating an XPath expression on a context node.- Specified by:
selectNodeList
in interfaceJRXPathExecuter
- Overrides:
selectNodeList
in classXalanXPathExecuter
- 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:JRXPathExecuter
Selects 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.Number
orjava.lang.Boolean
.- Specified by:
selectObject
in interfaceJRXPathExecuter
- Overrides:
selectObject
in classXalanXPathExecuter
- 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
-
containsPrefixes
protected boolean containsPrefixes(String expression)
-
extractXmlNamespaces
public Map<String,String> extractXmlNamespaces(Node contextNode) throws JRException
- Throws:
JRException
-
-