You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Dmitri Plotnikov <dm...@apache.org> on 2004/04/05 00:07:32 UTC
Re: [jxpath] problem with Container interface
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" <dm...@apache.org>
To: "Jakarta Commons Users List" <co...@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" <ja...@anecon.com>
> To: <co...@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