Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 94694 invoked from network); 2 Aug 2002 15:28:06 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 2 Aug 2002 15:28:06 -0000 Received: (qmail 26247 invoked by uid 97); 2 Aug 2002 15:28:25 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 26231 invoked by uid 97); 2 Aug 2002 15:28:25 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 26219 invoked by uid 98); 2 Aug 2002 15:28:24 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <4C47F66C98B28B4F903120350DEF05B0064437@hqexch01.upstate.com> From: EPugh@upstate.com To: commons-dev@jakarta.apache.org Subject: RE: [JXPATH] Formatting xpath syntax with Hashtable and iterators Date: Fri, 2 Aug 2002 11:25:03 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Ah well.. I was hoping it would somehow prove faster to use xpath versus actual java code, but I guess since everything is running through introspection/reflection then it needs to do more processing. I was hoping that on a complex xpath query you could somehow filter out all the wrong paths.. I will take your approach of using xpath (so much cleaner and tighter!) and then fix the holes later! Also, I read about using the compiled xpaths, what are the downsides of just always using a compiled xpath query, versus letting xpath do it itself? Eric -----Original Message----- From: Dmitri Plotnikov [mailto:dplotnik@yahoo.com] Sent: Friday, August 02, 2002 11:22 AM To: Jakarta Commons Developers List Subject: RE: [JXPATH] Formatting xpath syntax with Hashtable and iterators Eric, --- EPugh@upstate.com wrote: > And will this then return my Standard96WellPlate object because the > entire > path only returns a single top level value? If I did > well[reaction/atpConc='10']/reaction then it would return the > matching > Reaction object, correct? This is correct. Also, if you need to find _all_ wells that match the criteria, not just the first one, you can call context.iterate(path). > Also, are there any statistics on the overhead compared to doing all > the > java yourself? I haven't collected such statistics, but evaluation of an XPath is guaranteed to be _significantly_ (orders of magnitude) slower than direct Java code. My suggestion is: use JXPath until you run into an actual performance problem, then identify the paths that cause the problem and rewrite them to Java. > Eric - Dmitri > > -----Original Message----- > From: Dmitri Plotnikov [mailto:dplotnik@yahoo.com] > Sent: Thursday, August 01, 2002 4:47 PM > To: Jakarta Commons Developers List > Subject: Re: [JXPATH] Formatting xpath syntax with Hashtable and > iterators > > > Your XPath does indeed have a syntax problem. There should be no > slash > before the predicate. If I understand your requirement correctly, > the > correct syntax is: > > "well[reaction/atpConc='10']" > > I hope this helps, > > - Dmitri > > > --- EPugh@upstate.com wrote: > > Hi all, > > > > I am trying to use the latest version of JxPath, and am having some > > trouble > > understanding how iterators and lists are supported. My java code > > (fully > > expanded) is: > > > > String atpConc = data.getParameters().get( "atpConc" > > ); > > List masterPlates = (List) pageData.get( > > "masterPlates" ); > > Standard96WellPlate plate = null; > > for ( Iterator i = masterPlates.iterator(); > > i.hasNext(); ) { > > plate = (Standard96WellPlate) i.next(); > > PlateWell plateWell = (PlateWell) plate.get( > > 0 ); > > Reaction reaction = plateWell.getReaction(); > > if ( reaction.getAtpConc().equals( new > > BigDecimal( atpConc ) ) ) { > > break; > > } > > } > > > > I am attempting to find a Standard96WellPlate whose first well has > a > > reaction with the property Atpconc = a passed in atpConc. My xPath > > expression is: > > Standard96WellPlate plate = (Standard96WellPlate) > > JXPathContext.newContext( > > masterPlates ). > > getValue( "well[1]/reaction/[atpConc='10']/" ); > > > > However, I keep generating errors about the syntax after > > well[1]/reaction/.... I think my problem is that I don't have the > > properly > > xpath for find my first plate in the list of masterPlates... And I > > am not > > properly return a Standard96WellPlate, but something else.... > > > > Thanks, > > Eric > > > > -- > > To unsubscribe, e-mail: > > > > For additional commands, e-mail: > > > > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Health - Feel better, live better > http://health.yahoo.com > > -- > To unsubscribe, e-mail: > > For additional commands, e-mail: > > > -- > To unsubscribe, e-mail: > > For additional commands, e-mail: > > __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: