I’d like to take XML in the format below and load each code record into a domain object in my BootStrap.groovy. I want to preserve the formatting of each snippet of code.
XML
<records> <code> <language>Groovy</language> <snippet> println 'This is Groovy' println 'A very powerful language' </snippet> </code> <code> <language>Groovy</language> <snippet> 3.times { println 'hello' } </snippet> </code> <code> <language>Perl</language> <snippet> @foo = split(','); </snippet> </code> </records>
Domain Object
Code { String language String snippet }
BootStrap.groovy
new Code(language l, snippet: x).save()
roughly something like this: