2002 JI Open Discussion Posted September 2, 2006 Share Posted September 2, 2006 By: mauricio cordero - maucorpat2 org.apache.xpath.XPathException 2005-07-11 03:47When I compiling no error apear, when I execute the following error apear: ------------------------------------------------------------------------------------------------------------------------------- net.sf.jasperreports.engine.JRException: XPath selection failed. Expression: /GLOBAL/DAY+usrsAuthenAvg at net.sf.jasperreports.engine.data.JRXmlDataSource.getFieldValue(JRXmlDataSource.java:336) at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:872) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:116) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:622) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:116) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:428) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:344) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:571) at java.lang.Thread.run(Thread.java:534) Caused by: org.apache.xpath.XPathException: No se puede convertir #NUMBER en una NodeList. at org.apache.xpath.objects.XObject.error(XObject.java:741) at org.apache.xpath.objects.XObject.nodeset(XObject.java:471) at org.apache.xpath.CachedXPathAPI.selectNodeIterator(CachedXPathAPI.java:219) at org.apache.xpath.CachedXPathAPI.selectSingleNode(CachedXPathAPI.java:177) at org.apache.xpath.CachedXPathAPI.selectSingleNode(CachedXPathAPI.java:157) at net.sf.jasperreports.engine.data.JRXmlDataSource.getFieldValue(JRXmlDataSource.java:334) ------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- And for connection/database properties is: xml file = /home/ocordero/documentos/javadoc/JasperReport/reportesAirMonitor/xmlFileGroup.xml select expresion = /GLOBAL/DAY --- And for field is : fieldname = usrsAuthenAvg; class type = java.lang.string; field description= /GLOBAL/DAY+usrsAuthenAvg. --- And my xml file is: <?xml version="1.0" encoding="UTF-8"?> <GLOBAL CreationData="2005-07-07 16:48:12.972" Type="Uso de la red wireless"> <alarmHighTotal>717</alarmHighTotal> <alarmMediumTotal>86</alarmMediumTotal> <alarmLowTotal>2</alarmLowTotal> <DAY Date="2005-05-20 23:59:14.176"> <usrsAsocAvg>2</usrsAuthenAvg> <traficInAvg>3070</traficInAvg> </DAY> <DAY Date="2005-05-22 00:01:01.696"> <usrsAsocAvg>5</usrsAuthenAvg> <traficInAvg>1200</traficInAvg> </DAY> </GLOBAL> some curious is: If I change the """field description= /GLOBAL/DAY/usrsAuthenAvg."" from the data connection. otherwise if I change the simbol "+" for "/", no apear error when I run the repor from the iReport. But show the report wrong, since it shows the first data (DAY) twice without showing the second DAY. Please help me. I try for two days And I cant found the solution. Oscar from spain. By: Wal Millard - walmillard RE: org.apache.xpath.XPathException 2005-11-23 14:14 Ur xpath statement is incorrect. the + is the probelm i suggest you remove it and set your description to just simply usrsAuthenAvg and your xml datasource expression to /GLOBAL/DAY/ (Note this is all case sensitive) XPath Builds on your Expresion, so at runtime the entire expression (the xml datasource path, and the field description part) should look and point to a valid xml tag or attribute. i.e /GLOBAL/DAY/usrsAuthenAvg luck walmillard 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