commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dplot...@yahoo.com>
Subject RE: [JXPATH] Formatting xpath syntax with Hashtable and iterators
Date Fri, 02 Aug 2002 15:22:14 GMT
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:  
> > <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:commons-dev-help@jakarta.apache.org>
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
> 
> --
> To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:  
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message