Jump to content
Changes to the Jaspersoft community edition download ×

XML Datasource XPath problem

2004 IR Help

Recommended Posts

By: Vincenzo Amoruso - vinciamo

XML Datasource XPath problem

2005-03-17 09:13


I'm trying to read some Rows in XML document using JRXmlDatasource (jasper)!

But in the detail of report i can see only the first Row!











the Xpath selection writed in description

of the field is '/Doc/Row/MyTag'


I've tried all Xpath selection with no results!

Thanks in advance!


Regards Vincenzo!







By: Harlequin - di0hank

RE: XML Datasource XPath problem

2005-05-25 02:01

Try using the XPath '/Doc/Row' for the report and use 'Mytag' as the Xpath(description) for the field displaying the value in your detail band.


Hope this helps







By: nishant - nkaushik

RE: XML Datasource XPath problem

2006-03-28 06:39

Did you ever solve this problem?


I am trying to access the xml file and display the details in a pdf,i keep getting this error


Caused by: java.lang.LinkageError: Class org/w3c/dom/traversal/NodeIterator violates loader constraints: definition mismatch between parent and child loaders


if i have the description tag for the field....if i remove the description tag then the pdf is generated but i get all null values inside the report.........


this is the code i use to parse and compile the file


else if(request.getParameter("GetFromXMLSourceFormSubmit") != null){


Map params = new HashMap();




//Document document = JRXmlUtils.parse(new File("C:/WINDOWS/Profiles/nkaushik/IBM/rationalsdp6.0/workspace/Source/JasperReportsSampleWar/WebContent/WEB-INF/classes/northwind.xml"));

JRXmlDataSource xmlDataSource= new JRXmlDataSource(new File("C:/WINDOWS/Profiles/nkaushik/IBM/rationalsdp6.0/workspace/Source/JasperReportsSampleWar/WebContent/WEB-INF/classes/northwind.xml"),"/Northwind/Customers");

//JRXmlDataSource xmlDataSource= new JRXmlDataSource(document,"/Northwind/Customers");

JasperReport jasperReport = JasperCompileManager.compileReport("C:/WINDOWS/Profiles/nkaushik/IBM/rationalsdp6.0/workspace/Source/JasperReportsSampleWar/WebContent/WEB-INF/classes/Customers.jrxml");

//Document document = JRXmlUtils.parse(new File("C:/WINDOWS/Profiles/nkaushik/IBM/rationalsdp6.0/workspace/Source/JasperReportsSampleWar/WebContent/WEB-INF/classes/northwind.xml"));



//params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);


//JasperRunManager.runReportToPdfFile("C:/WINDOWS/Profiles/nkaushik/IBM/rationalsdp6.0/workspace/Source/JasperReportsSampleWar/WebContent/WEB-INF/classes/Customers.jrxml", params);

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params,xmlDataSource);







catch (JRException e)


i cant get pass beyond the message333333333... if description tag is there


plz advice



Link to comment
Share on other sites

  • 1 year later...
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic


Try to creating a docment of xmldatasource as follows:

Document document = JRXmlUtils.parse(new File(XML_Path));


Create HashMap

lets say "Hmap".



JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, Hmap,new JREmptyDataSource);


Try this it might help you.

Tell if t does.

Post edited by: nitin403, at: 2007/09/24 06:31

Link to comment
Share on other sites

Thanks Nitin,

I tried it and unfortunately it does not work.

I think the problem is due to xerces in classpath. I created a sample app just to check this out and xerces is causing this. This is a major show stopper for me. Now I have to either figure out how to work around this (cause I cannot delete/remove xerces from classpath) or ditch the whole idea of using xmldatasource :((

Thanks anyway.

Let me know if you think of something I can try.

Link to comment
Share on other sites

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...