Hi, To be quite honest I'm not sure where the "xs:" portions of your example, and question, are coming from. Maybe if you provide a little more basic detail to describe how you got to the point you're at with JXPath, the list could be of more help.
-Matt --- "Desai, Jasmina" <[EMAIL PROTECTED]> wrote: > I am using JXPATH to build a java expression which > can be used to get > records from a table if its columns fall between a > specific date range. > > Basically I have a client application which asks the > end user to enter a > date range. > > The application needs to get the results which fall > between the > specified date range. > > > > I have something like this for the lower value of > the date range: > > > > if (criterion.getValue() instanceof Date) { > > SimpleDateFormat dateFormat = new > SimpleDateFormat("yyyy-MM-dd"); // TODO 01-DEC-2007 > i.e. dd-MM-yyyy > > valueAsJXPath = "xs:date:('" + > dateFormat.format(((Date) criterion.getValue())) + > ")'"; //DOES NOT > WORK > > } > > > > Here the "Date" is of type java.util.Date. > > > > Then I have the following for the upper value: > > > > if (criterion.getUpperValue() instanceof Date) { > > SimpleDateFormat dateFormat > = new > SimpleDateFormat("yyyy-MM-dd"); > > upperValueAsJXPath = > "xs:date:('" + > dateFormat.format(((Date) > criterion.getUpperValue())) + ")'"; > > } > > > > > > The xpath sentence that gets created is something > like > > > > marketData/enteredMarketDate >= > xs:date:('2008-01-01)' and > marketData/enteredMarketDate <= > xs:date:('2008-01-15)' > > > > But I get an error which says: > > > > An Exception has occured: > org.apache.commons.jxpath.JXPathException: > Invalid XPath: > '/wirelessDevices[marketData/enteredMarketDate >= > xs:date:(\'2008-01-01)\' and > marketData/enteredMarketDate <= > xs:date:(\'2008-01-15)\' ]'. Syntax error after: > '/wirelessDevices[marketData/enteredMarketDate >= > xs:d' at > org.apache.commons.jxpath.ri.Parser.parseExpression(Parser.java:60) > at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.compileExpressio > n(JXPathContextReferenceImpl.java:218) at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.iterate(JXPathCo > ntextReferenceImpl.java:384) > > > > > > I am a first time user of JXPATH. Kindly help me > with this error. > > > > Also, I need to use the date as 01-DEC-2007 i.e. > dd-MM-yyyy instead of > yyyy-MM-dd. > > Will the xs:date accept the date in dd-MM-yyyy > format? > > > > Thanks > > Regards, > Jasmina > > > > Programmer Analyst, Sr > > Direct: (858) 651-1132 > > Ext: 11132 > > > > ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]