2004 IR Help Posted August 24, 2006 Share Posted August 24, 2006 By: Vincenzo Amoruso - vinciamo XML Datasource XPath problem 2005-03-17 09:13 Hi! 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! ... <Doc> <Row> <Mytag>aaa</MyTag> </Row> <Row> <Mytag>bbbb</MyTag> </Row> </Doc> 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 /Harlequin 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(); try { System.out.println("111111111"); //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")); System.out.println("22222222222222"); //params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document); System.out.println("333333333333333"); //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); System.out.println("444444444444444"); JasperExportManager.exportReportToPdfFile(jasperPrint,"c:/reportFromXML.pdf"); System.out.println("5555555555555555"); JasperExportManager.exportReportToHtmlFile(jasperPrint,"c:/reportFromXML.html"); System.out.println("66666666666666666666"); } catch (JRException e) i cant get pass beyond the message333333333... if description tag is there plz advice Nishant Link to comment Share on other sites More sharing options...
genx Posted September 24, 2007 Share Posted September 24, 2007 Hi, Were you able to resolve this? I get the same linkage error - inspite of the xml being valid, the document is null. Link to comment Share on other sites More sharing options...
nitin403 Posted September 24, 2007 Share Posted September 24, 2007 Hi!Try to creating a docment of xmldatasource as follows:Code:Document document = JRXmlUtils.parse(new File(XML_Path)); Create HashMap lets say "Hmap".Code:[code]Hmap.put("XML_DATA_DOCUMENT",document); Code:[code]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 More sharing options...
genx Posted September 25, 2007 Share Posted September 25, 2007 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 More sharing options...
niravjgosalia Posted July 19, 2008 Share Posted July 19, 2008 I have been breaking my head on this since 5 hours... Many thanks for this post. It was really helpful... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now