Read utf-8 xml file with abap
Details
- Details
- Category: ABAP
- Created on Thursday, 21 June 2012 07:04
- Last Updated on Wednesday, 27 February 2013 07:28
- Published on Thursday, 21 June 2012 07:04
- Written by Administrator
- Hits: 15022
Read utf-8 xml file and store it in string variable :
*--------------------------------------------------------------
* www.developerpages.gr
*
* Read UTF-8 xml file
*
*--------------------------------------------------------------
report zread_xml.
data XML_STRING type STRING.
DATA line TYPE string.
clear xml_string.
PARAMETERS xml_file(255).
OPEN DATASET xml_file IN TEXT MODE for input ENCODING UTF-8 .
if sy-subrc = 0.
DO.
READ DATASET xml_file INTO line.
IF sy-subrc <> 0.
EXIT.
else.
CONCATENATE xml_string line INTO xml_string.
ENDIF.
ENDDO.
if not xml_string is initial.
write :/ 'ready to parse xml...'.
else.
write :/ 'file is empty ! ', xml_file.
endif.
else.
WRITE :/ 'cannot open file ', xml_file.
endif.
click here if you want to see how to Parse xml file with ABAP