[solved]How to set property (xpath factory) to the jasperreport lib?

hi!

I know that normaly the setting about the xpath factory is configured by the jasperreports.properties file.

but is there also a way to set the xpath factory in the code?

The setting (or better the property) is: net.sf.jasperreports.xpath.executer.factory=net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory

evaluat0r's picture
Joined: Nov 24 2012 - 1:35am
Last seen: 10 years 2 months ago
I have tried this: net.sf.jasperreports.engine.util.JRProperties.setProperty("net.sf.jasperreports.xpath.executer.factory", "net.sf.jasperreports.engine.util.xml.XalanXPathExecuterFactory"); but i still receive the following error: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRRuntimeException: No query executer factory registered for the 'xPath' language.
evaluat0r - 10 years 3 months ago
I solved this problem using PY4J.
evaluat0r - 10 years 2 months ago

1 Answer:

This is how I do it in my (Java) code:

JasperReportsContext jrc = DefaultJasperReportsContext.getInstance();

jrc.setProperty(

    JRXPathExecuterUtils.PROPERTY_XPATH_EXECUTER_FACTORY,
    XalanNamedParameterXPathExecutor.class.getCanonicalName());
 
JasperFillManager jfm = JasperFillManager.getInstance(jrc);
dablick's picture
53
Joined: Jan 17 2013 - 8:26am
Last seen: 9 years 7 months ago
Feedback