cancel
Showing results for 
Search instead for 
Did you mean: 

Add carriage return in XML file

Former Member
0 Kudos

Hi,

I found a topic that correspond to my requirement :

[Add carriage return in XML file|https://wiki.sdn.sap.com/wiki/display/XI/HowtoappendCarriageReturnintheendofeachtagofxml+file]

But i don't know where created this udf, which input parameter pass?

Thank you for your help.

Accepted Solutions (1)

Accepted Solutions (1)

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

I think you can do this....

Follow my wiki [Java Mapping- Convert the Input xml to String |https://wiki.sdn.sap.com/wiki/display/XI/JavaMapping-ConverttheInputxmlto+String] to convert the xml to string using Java maping then pass this string field as an input to the UDF told in the wiki u were referning. This will insert a carriage reurn.. You can write this XML payload using Receiver channel with simple FCC.

~Sanv...

Former Member
0 Kudos

It's now works. My last problem was, i not use correct FCC.

Thank you all.

Answers (3)

Answers (3)

Former Member
0 Kudos

refer this blog[https://weblogs.sdn.sap.com/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]]

Former Member
0 Kudos

Thank you for your help.

I work on your solution, it practically works. In the result instead to have < i have the character &#60 ; .

Do you know how to solve it?

Former Member
0 Kudos

Hi Frantzy,

The link does not give enough explanation. What I am assuming is if you have xml string in one field then if you need to add new line after each tag then you can follow that.

If you want a udf where you want to insert a new line use this udf:

Create a Value UDF with one input argument 'a' and name the udf as addnewline. Then add this code:

Imports: java.*;

String lines;

lines = "";

lines = lines.concat(a + '\n' );

return lines;

Then where ever you want a new line just add this udf in your mapping. If you want a new line for 10 fields then you can put in all the 10 fields.

Example:

Source field --> logic --> udf (addnewline) --> target.

So after logic if you have the value as 123 then in the target you will see 123 followed by a carriage return.

Regards,

---Satish