Skip to Content
avatar image
Former Member

SAP HCI; XML to CSV: Unmarshalling XML failed

Hi experts,

I am trying to use XML to CSV after I manipulated it using groovy script. However, I am getting an error

com.sap.it.rt.xmltocsv.converter.exception.XmlToCsvConversionException: Unmarshalling XML failed.

I am not sure if there is something wrong with my groovy script (step before XML to CSV). All it does is add two new parent-child structure to the existing message.

def Message processData(Message message) {

//Body def body = message.getBody(String.class);

def root = new XmlParser().parseText(body.toString())

def children = root.Recordset[0].children();

def headerLine = new Node(null, 'Parent', []) def value = new Node(headerLine, 'Line', root.HeaderLine.text())

def footerLine = new Node(null, 'Parent', [])

def value1 = new Node(footerLine, 'Line', root.FooterLine.text())

children.add(0, headerLine)

children.add(footerLine)

message.setBody(root.toString());

//Header

def map = message.getHeaders(); value = map.get("oldHeader"); message.setHeader("olderHeader", value + "modified") message.setHeader("newHeader", "newHeader")

//Properties

map = message.getProperties(); value = map.get("oldProperty"); message.setProperty("oldProperty", value + "modified"); message.setProperty("newProperty", "newProperty");

return message;

}

I have no errors in Groovy script and it creates the target xml that I want, however when I connect it to XML to CSV, it is not working and the error shows up.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 05, 2017 at 04:24 PM

    Hello Raye,

    Could you please share input and output for your script step.

    Regards,

    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded