Groovy markupBuilder updating parent node
问题 I'm building xml using MarkupBuilder and wonder how can I update a parent attribute when creating a child node. Assuming the number of child elements cannot be calculated when building the parent element. def writer = new StringWriter() def xml = new MarkupBuilder(writer) xml.parent(totalDuration: 'should be: some of all child duration') { child(duration: '1') child(duration: '2') ... } Is there an elegant way of accessing the parent node from a child node? Thanks Tal 回答1: Is there an elegant