Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3184

IF_IXML : How can i add encoding with value UTF-8 to the document object??

$
0
0

Hi

 

i want to create a xml file with the following content:

 

<?xml version="1.0" encoding="UTF-8"?>

<OpenSearchDescription xmlns="http://...."> 

</OpenSearchDescription>

 

i did this with the if_ixml interface and rendered the content in a file 'D:\usr\sap\IFD\DVEBMGS01\log\TEST_out.xml

 

<?xml version="1.0"?>

<OpenSearchDescription xmlns="http://...."> 

</OpenSearchDescription>

 

BUT the document attribut(?) encoding="UTF-8"?> is missing!

 

How can i add encoding with value UTF-8 to the document object?? it should look like:

<?xml version="1.0" encoding="UTF-8"?>

 

 

 

***************************************************

*here is my coding.

 

TYPE-POOLS: ixml.

CLASS cl_ixml DEFINITION LOAD.

 

DATA: lo_ixml           TYPE REF TO if_ixml,

      lo_streamfactory  TYPE REF TO if_ixml_stream_factory,

      lo_document       TYPE REF TO if_ixml_document,

      lo_parent         TYPE REF TO if_ixml_element,

      lo_ostream        TYPE REF TO if_ixml_ostream,

      lo_renderer       TYPE REF TO if_ixml_renderer,

     lv_rc           TYPE i.

 

lo_ixml = cl_ixml=>create( ).

lo_streamfactory = lo_ixml->create_stream_factory( ).

lo_document = lo_ixml->create_document( ).

 

lo_parent = lo_document->create_simple_element( name   = 'OpenSearchDescription'  "root node

                                                parent = lo_document ).

lo_parent->set_attribute_ns( name   =  'xmlns'

                             value  = 'http://....' ).

 

 

*rausrendern in file

lo_ostream = lo_streamfactory->create_ostream_uri( system_id = 'D:\usr\sap\IFD\DVEBMGS01\log\TEST_out.xml' ).

lo_renderer = lo_ixml->create_renderer( ostream  = lo_ostream

                                        document = lo_document ).

lv_rc = lo_renderer->render( ).

 

********************************************************

Thanks for help

Britta


Viewing all articles
Browse latest Browse all 3184

Trending Articles



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