Recent project required to use groovy scripted mapping, using StreamingMarkupBuilder to produce output XML, then post to Odata services.
Below is the skeleton content in groovy script. With this script, can act as alternative to graphical mapping, and use groovy/java language to read source xml, extract value, put in variable, and output to target xml using template, in a very clean, easy readable, procedural programming way.
This is comparable to SAX parsing method in Java Mapping, but in a cleaner syntax, concise, not so verbose like pure Java XML manipulation.
You can run the script in any external java/groovy editor. Example IntelliJ IDEA. The function TestRun() act as a mock test receive input from file, and output to file.

Groovy Scripted Mapping using StreamingMarkupBuilder
Tagged on:     

2 thoughts on “Groovy Scripted Mapping using StreamingMarkupBuilder

  • September 24, 2018 at 9:46 pm

    to try, idoc sample is needed (Z_IDOC.txt)
    could you post it?

    • January 16, 2019 at 10:49 am

      hi, those Z_IDOC.txt is mock up idoc based on real idoc for illustrate the concept, so not really have sample data. You can use any idoc xml you have, and just change the idoc path according to get the values in your idoc.


Leave a Reply

Your email address will not be published. Required fields are marked *