def xmlString = """<?xml version="1.0" encoding="utf-8"?> <ledesxmlebilling2.1 xmlns="http://w...content-available-to-author-only...s.org/ledes21.xsd">""" def xml = new XmlSlurper().parseText(xmlString) def invoices = xml.'**'.findAll{it.name() == 'invoice'} println invoices.collectEntries {inv -> [(inv.inv_id): inv.'**'.findAll{it.name() == 'file_item_nbr'}*.text()] }
Standard input is empty
[Invoice 31:[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33], Invoice 32:[50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73]]