I'm doing some XML processing with groovy. Specifically, I'm inhaling an XML file via XMLParser, doing a whole batch of in-memory processing, and then serializing the resulting data back out to XML via a MarkupBuiler.
The vast majority of the data in the file gets transferred to a non-xml based object hierarchy to talk to the gui and have processing done, so the two XML files never know about each other.
However, there is one slug of XML that lives at the edge of the source file that needs to get copied verbatim to the output XML file with little or no processing. Is there a way I can hand the MarkupBuilder a nodelist from XMLParser and have it just insert that into the document?
Something like this:
def builder = new MarkupBuilder()
builder.outermosttag( name: 'library') {
someothertag( name: 'shelf' ) {
//magically insert a nodelist of arbitrary XML from somewhere else
}
}