Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.3
-
None
-
JDK 6
-
Patch
Description
Given the standard XML example from the documentation, the following GPath expressions did not return the same result:
records.car.country
records.car.findAll({ true }).country
The reason is a missing implementation of childNodes() in FilteredNodeChildren.
Merging the code patterns for flattening all the child iterators in NodeChildren and for filtering with the lazy-evaluated closure originally passed to the parent via .findAll() in the existing iterator implementations of FilteredNodeChildren.
The suggested implementation (uploaded) passes all the assert in the documentation example. It also passes these additional asserts, proving that two findAll() filters can be chained and the GPath can be further extended beyond the filter:
assert records.car.findAll({ true }).country == 'AustraliaIsle of ManFrance' assert records.car.findAll({ it.@make =~ /e/ }).record.@type == 'speedsize' assert records.car.findAll({ true }).findAll({ it.@make =~ /ug/ }).country == 'France'