Hello,
Ok. You can use the below code to convert your xml data into string and replace the actual XML declaration with the blank string -
Header 1 |
---|
public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException { try { InputStream inputstream = transformationInput.getInputPayload().getInputStream(); OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream(); // a) Copy Input content to String byte[] b = new byte[inputstream.available()]; inputstream.read(b); String inputContent = new String(b);
inputContent = inputContent.replaceAll("<?xml version= \"1.0\" encoding= \"UTF-8\" ?>", "");
outputstream.write(inputContent.getBytes()); } catch (Exception exception) { getTrace().addDebugMessage(exception.getMessage()); throw new StreamTransformationException(exception.toString()); } } |
Regards,
Nitin