XML (Utf-8) dönüşümünde Türkçe karakter problemi
form f_talep_detay_format using prm_response type string
changing chn_data type zxml_s_detay.
data: ls_data type zxml_s_detay.
data: l_ixml type ref to if_ixml,
l_streamfactory type ref to if_ixml_stream_factory,
l_istream type ref to if_ixml_istream,
l_parser type ref to if_ixml_parser,
l_document type ref to if_ixml_document,
lx_response type xstring.
data app_type(50) value `text/xml; charset=utf-8`.
call function `SCMS_STRING_TO_XSTRING`
exporting
text = prm_response
mimetype = app_type
encoding = `1610`
importing
buffer = lx_response
exceptions
failed = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
data: lv_rval_int type int4.
l_ixml = cl_ixml=>create( ).
l_streamfactory = l_ixml->create_stream_factory( ).
l_document = l_ixml->create_document( ).
l_istream = l_streamfactory->create_istream_xstring( string = lx_response ).
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* Parse the stream
if l_parser->parse( ) ne 0.
return.
* message `Ayrıştırılamadı` type `E`.
exit.
endif.
data: curr_node_collection type ref to if_ixml_node_collection,
curr_node_iterator type ref to if_ixml_node_iterator,
curr_node type ref to if_ixml_node,
curr_nodemap type ref to if_ixml_named_node_map,
curr_attr type ref to if_ixml_node,
curr_node_list type ref to if_ixml_node_list,
lv_val_source type string,
lv_val type string,
lv_val_tr type string,
lv_val_xtr type xstring,
lv_fieldname type string,
lv_length type i,
lv_indx type i,
lv_xstr_utf8 type xstring.
data: lv_date_str type string.
data: lv_time_str type string.
data: lv_table_name type string.
curr_node_collection = l_document->get_elements_by_tag_name( name = `TALEP_DETAYIResponse` ).
curr_node_iterator = curr_node_collection->create_iterator( ).
curr_node = curr_node_iterator->get_next( ).
while curr_node is not initial.
clear ls_data.
curr_node_list = curr_node->get_children( ).
clear lv_length.
lv_length = curr_node_list->get_length( ).
do lv_length times.
lv_indx = sy-index - 1.
curr_attr = curr_node_list->get_item( lv_indx ).
if curr_attr is not initial.
lv_fieldname = curr_attr->get_name( ).
lv_val = curr_attr->get_value( ).
case lv_fieldname.
when `ALAN1`. ls_data-ALAN1= LV_VAL.
when `ALAN2`. ls_data-ALAN2 = LV_VAL.
when `ALAN3`. ls_data-ALAN3 = LV_VAL.
endcase.
endif.
enddo.
chn_data = ls_data.
curr_node = curr_node_iterator->get_next( ).
endwhile.
endform. "f_talep_detay_format