2013 Aug 02 4:07 PM
Hi All,
I am trying to modify XMl file where encoding tag should have value as "UTF-8" instead of iso-8859-1.
For this, I have implemented BADI "DMEE_BADI_01" into custom BADI.
However, file gets modified by using below code.
REPLACE ALL OCCURRENCES OF REGEX '\b(iso-8859-1)\b'
IN TABLE c_output_tab WITH 'UTF-8'.
But while opening generated file with internet explorer or and mozilla, I am getting the following error:
"Invalid at the top level of document. Error processing resource <Filename with Path>"
Can anybody please help me to resolve this issue?
Thanks & Regards,
Pratima.
Hi All,
I am trying to modify XMl file where encoding tag should have value as "UTF-8" instead of iso-8859-1.
For this, I have implemented BADI "DMEE_BADI_01" into custom BADI.
However, file gets modified by using below code.
REPLACE ALL OCCURRENCES OF REGEX '\b(iso-8859-1)\b'
IN TABLE c_output_tab WITH 'UTF-8'.
But while opening generated file with internet explorer or and mozilla, I am getting the following error:
"Invalid at the top level of document. Error processing resource <Filename with Path>"
Can anybody please help me to resolve this issue?
Thanks & Regards,
Pratima.
2013 Aug 03 8:18 AM
Hi Pratima,
There are reason why they are used ... They are encoding and depending on that the XML praser reads your document.
So if your document is build as UTF-8 and you change the Encoding to ISO it will not open as the characters are of ISO and the document is of UTF
For more details
Regards
2013 Aug 03 9:34 AM
Perhaps classes CL_ABAP_CONV_IN_CE and CL_ABAP_CONV_OUT_CE can be used to change encoding. That, in addition to your replace statement may work.
Do read the class documentation.
2013 Aug 03 10:32 AM
Hi,
Check the SAP Note 1017101. Might help to get more idea on the encodings involved. I think just changing the encoding type at header won't help. You may have to transform the data completely for proper interpretation of the XML data.
You might take help of PI XML Anonymizer if its there.
http://wiki.sdn.sap.com/wiki/display/XI/Changing+Namespaces+and+the+encoding+format+of+XML
Cheers,
Arindam