[
https://issues.apache.org/jira/browse/JXPATH-156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lukas Krejci updated JXPATH-156:
--------------------------------
Affects Version/s: 1.3
> iteratePointers on relative context returns incorrect values for
> multidimensional arrays
> ----------------------------------------------------------------------------------------
>
> Key: JXPATH-156
> URL: https://issues.apache.org/jira/browse/JXPATH-156
> Project: Commons JXPath
> Issue Type: Bug
> Affects Versions: 1.3
> Reporter: Lukas Krejci
>
> Let's have multidimensional array/collection as an input.
> I would like to iterate through both inner and outer list. iteration through
> the inner list is relative to iteration of outer list, so I'm using relative
> context for that:
> {code}
> List<String> array1 = Arrays.asList("what", "is");
> List<String> array2 = Arrays.asList("wrong", "?");
> List<List<String>> strings = Arrays.asList(array1, array2);
> JXPathContext context = JXPathContext.newContext(strings);
> Iterator it = context.iteratePointers(".");
> while (it.hasNext()) {
> Pointer p = (Pointer) it.next();
> JXPathContext context2 = context.getRelativeContext(p);
> Iterator it2 = context2.iteratePointers(".");
> while (it2.hasNext()) {
> Pointer p2 = (Pointer) it2.next();
> System.out.println(p2.getValue());
> }
> }
> {code}
> Unfortunately the inner iteration returns the inner collection instead of
> it's items. So the output is following:
> {code:xml}
> [what, is]
> [wrong, ?]
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira