You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "David Marsh (JIRA)" <ji...@apache.org> on 2017/07/03 13:43:00 UTC
[jira] [Created] (JXPATH-191) List operations and Predicates do not
seem to work
David Marsh created JXPATH-191:
----------------------------------
Summary: List operations and Predicates do not seem to work
Key: JXPATH-191
URL: https://issues.apache.org/jira/browse/JXPATH-191
Project: Commons JXPath
Issue Type: Improvement
Reporter: David Marsh
This program does not work :-
public static void main(String[] args) {
Deal deal = new Deal();
Quote firstQuote = (Quote)JXPathContext.newContext(deal).
getValue("quotes[1]");
Quote lastQuote = (Quote)JXPathContext.newContext(deal).
getValue("quotes[last()]");
System.out.println(lastQuote.id);
}
private static class Deal {
private List<Quote> quotes = new ArrayList<>();
{
quotes.add(new Quote(1));
quotes.add(new Quote(2));
}
public Collection<Quote> getQuotes() {
return quotes;
}
}
private static class Quote {
int id;
public Quote(int id) {
this.id = id;
}
}
Exception in thread "main" org.apache.commons.jxpath.JXPathException: Cannot access property: com.baml.gmdp.ux.reporting.model.generic.JXPathTest$Deal.quotes; No read method
Most importantly id like to do XPath experessions like "quotes[last()]".
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)