on ‎2020 Nov 26 5:22 PM
Hello Experts,
I have got a requirement where Incoming xml with encoding version 'UTF-8' as below and output file is expected with 'ISO-8859-1' tag.
Input:<?xml version="1.0" encoding="UTF-8"?>
Output: <?xml version="1.0" encoding="ISO-8859-1"?> (Required)
Sample file structure below;
<?xml version="1.0" encoding="UTF-8"?>
<EMPLEADOS>
<EMPLEADO NUMERO="100000676" TIPO="A">
<PROCESO PAC="000000" PERIODO="12345" TT="MN"/>
<SECCION ID="ABCD">
<CAMPO1 FECHA="" ID="PTP_POCATP" SEC="">0.97</CAMPO1>
<CAMPO2 FECHA="" ID="PTP_SPPOC105" SEC="">39.0</CAMPO2>
</SECCION7>
</EMPLEADO>
</EMPLEADOS>.
Do we have any groovy to fulfil this requirement. Please suggest.
Thanks in advance,
Best Regards,
Sree
Request clarification before answering.
Hi sreekar ,
As explained above please store the value as a property" CamelCharsetName"
After that please use the below code in the mapping then you will achieve the data as output:
import com.sap.it.api.mapping.*;
import com.sap.it.api.mapping.MappingContext;
def String getProperty(String CamelCharsetName, MappingContext context) {
def propValue= context.getProperty(property_name);
return propValue;
}
Where You need to pass constant as " CamelCharsetName" to the Script and Map the target field.
Regards,
Vijender
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.