I have a problem with XML datasource for Jasper Reports. When i use selectExpression
in JRXmlDataSource
constructor, everything works, but when i u
I have found solution. Instead of passing a XML dataSource to JasperFillManager
, it can be passed an XML document like below. Now XPath in <queryString language="xPath">
inside .jrxml
template works on passed document and that's it what i want.
Document document = JRXmlUtils.parse(JRLoader.getLocationInputStream(dataSourceFile));
params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
jasperPrint = JasperFillManager.fillReport(jasperReport, params);