cancel
Showing results for 
Search instead for 
Did you mean: 

messagetransformbean - entire file to single element data

sandip_hole
Participant
0 Kudos

Hello experts,

A quick question is it possible to dump entire txt file content to single element in xml structure using messagetransformbean?

file contains random data with multiple lines

File Data-

1x2x3xasdfghjkl123456zxcvbnm

adjolm123456nuklldr

1234688900qwertyuuii

asdf

1234

qwert

can i make it to xml structure like---

<Node>

<Data>

1x2x3xasdfghjkl123456zxcvbnm

adjolm123456nuklldr

1234688900qwertyuuii

asdf

1234

qwert

</Data>

</Node>

if yes,how can i achive this conversion using messagetransformbean?

Accepted Solutions (1)

Accepted Solutions (1)

sandip_hole
Participant
0 Kudos

separated the data in java mapping, as required.

Thanks,

Sandip Hole

Answers (3)

Answers (3)

smavachee
Active Contributor
0 Kudos

Another alternative method you can use, if you are below PI 7.1, you can refer

Whole Payload to a XML field

Or if you are using PI 7.1, find very well articulated blog by Jyothi Anagani at

Hope it help.!

Regards,

Sunil

sandip_hole
Participant
0 Kudos

Thanks Sunil, but i want the entire file into single data element of xml. basically at sender adapter.

smavachee
Active Contributor
0 Kudos

Any specific requirement to have it at sender adapter itself ? if file with single element is expected at receiver end.

And even java mapping given by Shabarish will work in similar way, isnt.!

Regards,

Sunil

gagandeep_batra
Active Contributor
0 Kudos

hi sandip,

i am not sure but you can try to give the field separator as unique which is not in the file something spacial charater like(#,@,^...) , or give field separator as blank.

Regards

Gagan

sandip_hole
Participant
0 Kudos

Even i thought of  handling using special charactors but by default it takes new line to next <Data> element, is there any way or parameter in messagetransformbean to egnore new line feed?

sandip_hole
Participant
0 Kudos

i am able to transform to multiple each line <Data> elements, can i make it all lines to single <Data>