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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to