Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Convert XML to Flat File
def xmlToFlatFile(xml, tag, mapping) {
def flatFile = new StringBuffer()
xml[tag].each { row ->
mapping.each { col ->
col.closure.delegate = [(tag): row]
def result = col.closure() ?: ''
flatFile << result
.substring(0, col.length)
flatFile << System.getProperty('line.separator')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.