logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Bug handling xpath expressions in Chiba 0.9.2!!!: msg#00032

Subject: Re: Bug handling xpath expressions in Chiba 0.9.2!!!
> no, here is uli ;-) joern doesn't have to do all this stuff alone.

Hi Uli.  Thanks for stepping in to lighten the load on Joern.  ;-)

> thanks for the detailed report. accidently, i ran into a similar
> situation. i just fixed it. see below.

Most excellent....

> good analysis. the reason for this special attribute handling is the use
> of JXPath. usually, we use it throughout chiba for the xpath stuff and
> it does a great job. but when it comes to attributes problems arise.
> here we have the problem, that JXPath returns the *value* instead of the
> *node* when calling pointer.getNode() for an attribute.

Thanks...I figured the root cause was something to do with JXPath handling of 
attributes.

> your patch seems to be completely ok for your purpose. i found a more
> general solution. just put code like
> 
>  String canonicalPath =
> this.instanceContext.getPointer(locationPath).asPath();
> 
> before the if-statement and replace all subsequent occurrences of
> 'locationPath' in the method with 'canonicalPath', which leads to
> 
>  if (canonicalPath.indexOf('@') > -1) {
>   int index = canonicalPath.lastIndexOf('/');
>   ...
> 
> and so on.
> 
> this does the trick, since getPointer().asPath() canonicalizes the
> specified path and we can safely look for the '@' character. for your
> example this means:
> 
>  locationPath = "/root/name[@id='name1']"
>  canonicalPath = "/root[1]/name[1]"

I just replaced my "hacks" (I had actually solved a more general case, but 
not as elegantly as you had, not knowing the JXPath API much) and texted it 
out...works fine on my very complex application!

> just checked in my changes so the bug is fixed in the upcoming 0.9.3
> release. fine ?

Many thanks!


Andrzej Jan Taramina
Chaeron Corporation: Enterprise System Solutions
http://www.chaeron.com



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>