on 03-21-2014 10:29 AM
Good Morning All,
I've an issue with link breaks in XML. Basically, the scenario is IDoc (SAP) to File (XML 3rd Party System).
I've mapped a text field from the IDoc to the XML node (<comments>) . The text data comes across with a delimiter !$! to indicate where a line break should occur within the <comment> node in the XML
For example the text line comes across in the IDoc as line 1!$!This is Line 2!$! this one is line 3!$! and within the xml file I need to the <comment> node to look like <comment>line 1
This is line 2
this one is line 3</comment>
We need this for formatting in the 3rd party system. I've tried various replaces etc. but the new line never seems to get recognized.
Any help with this would be very much appreciated.
Thanks
G
Use OS specific new line character by using System.getProperty("line.separator"😞
Here is complete code:
UDF with Context option
Parameters:String var[], ResultList result)
String temp[] = var[0].split("!$!");
for(int i = 0; i < temp.length; i++)
{
result.addValue(temp[i] + System.getProperty("line.separator"));
}
Check it should work, I have not tested...
--Divyesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello to you Divyesh,
Thanks so much for the UDF logic. It works to a point. it splits the first line but nothing else so:
<comment> line 1!$!This is Line 2!$! this one is line 3!$! </comment>
becomes
<comment>line 1
</comment>
do i needs to change some logic to ensure the rest of the line is considered ?
thanks again
Gary
EDIT - When I check the result of the mapping using 'Display Queue' I can see it working however in the resulting XML just the first line is displayed as above
Hi Gary
Have you tried with an UDF?
In any case, I think that you have to know which code/character is used in target system to do a carriage return
Regards
Javi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.