Search code examples
xmlpentaho

Build Rest XML body in pentaho


I'm trying to build an xml body(like below) to send as part of my rest call.

<Columns>
  <Column>
    <Name>email</Name>
  </Column>
  <Column>
    <Name>firstname</Name>
  </Column>
  <Column>
    <Name>lastname</Name>
  </Column>
</Columns>

Using generate rows and Add XML i was able to build below structure

<Columns>
   <Column>email</Column>
   <Column>firstname</Column>
   <Column>lastname</Column
</Columns>

However adding additional tag (Name) around the values proves to be tricky.

Any pointers in the right direction would be of help.

ktr file in this location: http://pastebin.com/wk81GqLa

Thanks


Solution

  • Not sure if this is the right way of doing it, but it provides the output i'm looking for.

    I've added a modified javascript value process with

    var replval = replace(replace(Columns,'</Column>','</Name></Column>'),'<Column>','<Column><Name>');