Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Bug First Char in my XML String (if_ixml_document)

$
0
0

Hello,

 

I use "if_ixml" object to build an XML String.

 

This is my code :

DATA: lo_ixml TYPE REF TO if_ixml.

   DATA: lo_document TYPE REF TO if_ixml_document.

   DATA: lo_mt_response TYPE REF TO if_ixml_element.

   DATA: lo_streamfactory TYPE REF TO if_ixml_stream_factory.

   DATA: lo_ostream TYPE REF TO if_ixml_ostream.

   DATA: lo_renderer TYPE REF TO if_ixml_renderer.

   DATA: lo_encoding TYPE REF TO if_ixml_encoding.

 

   CONSTANTS: c_encoding TYPE string VALUE 'UTF-8'.

 

   lo_ixml = cl_ixml=>create( ).

 

   lo_document = lo_ixml->create_document( ).

 

   lo_encoding = lo_ixml->create_encoding( character_set = c_encoding

                                           byte_order = 0 ).

   lo_document->set_encoding( encoding = lo_encoding ).

 

   lo_mt_response = lo_document->create_simple_element(

                                   name    = 'MT_Agreement_Response'

                                   parent  = lo_document ).

 

   lo_streamfactory = lo_ixml->create_stream_factory( ).

 

   lo_ostream = lo_streamfactory->create_ostream_cstring( string = response ).

 

   lo_renderer = lo_ixml->create_renderer( ostream  = lo_ostream

                                           document = lo_document ).

 

   lo_ostream->set_pretty_print( 'X' ).

 

   lo_renderer->render( ).

 

When i read my XML String (response) i have a bug with first char.

<?xml version="1.0" encoding="utf-16"?>

<MT_Agreement_Response/>

 

And the encoding is not "UTF-8"

 

If you have an idea ... ?

 

I read the XML Response in .Net (Web Service)

But in my Abap Debugger this problem is already present, not a .Net problem.

 

Thank you in advance.

Youri


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>