JRXmlDataSource with queryString give no records

后端 未结 1 1503
予麋鹿
予麋鹿 2021-01-01 05:09

I have a problem with XML datasource for Jasper Reports. When i use selectExpression in JRXmlDataSource constructor, everything works, but when i u

相关标签:
1条回答
  • 2021-01-01 06:07

    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);
    
    0 讨论(0)
提交回复
热议问题