Essentially you are asking if you can access non-child attributes of a
Collection. Normally you would access the elements of a Collection as
nodes with iterate (rather than getValue). It seems to want to treat
Collections as NodeSets rather than as Nodes. So it works if Bar has an
ArrayList property, but not if Bar is a subclass of ArrayList as in your
example. Maybe you can do something with a Container...
http://jakarta.apache.org/commons/jxpath/apidocs/org/apache/commons/jxpath/Container.html
Vos, Jerry R. wrote:
In JXPath I have a class that extends Collection and I am trying to grab
data from it, ignoring that it happens to be a collection. Unless I am
missing something, JXPath appears to only allow you to work with a
Collection's contents, not the collection itself, so I was hoping there
was some simple way around this.
For example, here's a class:
public class Bar {
public String getX() { return "xValue" }
}
If I do:
JXPathContext jxContext = JXPathContext.newContext(new Bar());
jxContext.setLenient(true);
System.out.println(jxContext.getValue("x));
I get "xValue" printed to the console. However, if my class is:
public class Bar extends ArrayList {
public String getX() { return "xValue" }
}
And I do the above code, null is printed to the console. Is there a way
I can get at the X property?
Thanks,
Jerry
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]