需要一种方法来搜索具有最大日期 + 值 ==“001”的条目
如果我这样做是为了找到具有最大日期 + 值 ==“001”的条目,则它不起作用。有没有办法进行组合查询?
def xmls = new XmlSlurper().parse(new File("C:/file.xml"));
Object oTest = xmls.Test.Entry.find{ v -> v.Value == "001" }.max{ d ->
Date.parse('MM/dd/yyyy', d.Date.toString())
输入xml示例:
<Test>
<Entry>
<Date>01/12/2017</Date>
<Value>001</Value>
</Entry>
<Entry>
<Date>02/15/2017</Date>
<Value>001</Value>
</Entry>
<Entry>
<Date>03/15/2017</Date>
<Value>002</Value>
</Entry>
</Test>
我需要的输出是:
Date>02/15/2017</Date>
<Value>001</Value>
不负相思意
相关分类