commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Plotnikov" <dmi...@apache.org>
Subject Re: [jxpath] problem with Container interface
Date Sun, 04 Apr 2004 22:07:32 GMT
The problem is now fixed.  In some situations JXPath would not open
containers during path traversal.  I went through the entire code base to
see that container opening is done properly everywhere.

I ran the test you provided and it now runs fine.

Thank you very much for pointing out this problem.

- Dmitri

----- Original Message ----- 
From: "Dmitri Plotnikov" <dmitri@apache.org>
To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
Sent: Tuesday, March 09, 2004 12:08 PM
Subject: Re: [jxpath] problem with Container interface


> I'll look into this.  I haven't tried putting a collection in a
container -
> it's quite possible there is a bug there.
>
> Out of curiosity - what purpose does the container serve in your
situation?
> Why don't you use the contents of the container as the context object?
>
> Thanks,
>
> - Dmitri
>
> ----- Original Message ----- 
> From: "Uwe Janner" <janner@anecon.com>
> To: <commons-user@jakarta.apache.org>
> Sent: Monday, March 08, 2004 1:38 PM
> Subject: Re: [jxpath] problem with Container interface
>
>
> > to describe my problem more precisely, i also append this test;
> > i dont understand why it evaluates correcty with index [1], but not with
> > index [2].
> > both ctx.getValue("/a") and ctx.getValue("/b") correctly evaluate to the
> > whole arraylist "[x,y]";
> >
> > thank you in advance for any help, uwe!
> >
> > public class XpathUtilTest extends TestCase {
> >     public void testEval(){
> >         JXPathContext ctx = JXPathContext.newContext(new MyObject());
> >         // this test succeeds:
> >         assertEquals("x", ctx.getValue("/a[1]"));
> >         // this test fails because of:
> >         // "JXPathException: No value for xpath: /a[2]"
> >         assertEquals("y", ctx.getValue("/a[2]"));
> >     }
> >     public class MyObject implements Container{
> >         Map map;
> >         public MyObject(){
> >             map = new HashMap();
> >             map.put( "a", new ListEntry()); map.put( "b", new
> ListEntry());
> >         }
> >         public Object getValue() {
> >             return map;
> >         }
> >         public void setValue(Object arg0) {}
> >     }
> >     public class ListEntry  implements Container{
> >         private List list;
> >         public ListEntry(){
> >             this.list = new ArrayList();
> >             list.add("x"); list.add("y");
> >         }
> >         public Object getValue() {
> >             return list;
> >         }
> >         public void setValue(Object arg0) {}
> >     }
> > }
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message