Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9024

Create two xml files with all values same using dom.

$
0
0


Hi Experts,

 

I have a requirement of creating two xml at desktop with same data other then field which will have value T in first file and value E on other xml file.

All other values will be same. I created the xml using DOM method

 

My first xml is getting successfuly created.Then before creating 2nd xml i change the content of this paricular field and again try to create 2nd xml.

2nd xml is alos getting created but with the same content.

 

Here is the code that i written . I have already checked that code to change the xml content is working correct. The problem is that i am not able to create the 2nd xml with updated content.

 

 

 

lo_ostream1  = lo_ostream.



  lo_renderer = lo_ixml->create_renderer( ostream  = lo_ostream

                                            document = lo_document ).

  lo_renderer->render( ).



  l_xml_size = lo_ostream->get_num_written_raw( ).



  CALL METHOD cl_gui_frontend_services=>gui_download

    EXPORTING

      bin_filesize = l_xml_size

      filename     = 'D:\WIP\flight.xml'

      filetype     = 'BIN'

    CHANGING

      data_tab     = l_xml_table

    EXCEPTIONS

      OTHERS       = 24.







** Close file

  CALL METHOD lo_ostream->close( ).



* Create iterator

  CALL METHOD lo_document->create_iterator

    RECEIVING

      rval   = lo_iterator.







  lo_node = lo_iterator->get_next( ).



  WHILE lo_node IS NOT INITIAL.

    lw_string = lo_node->get_name( ).



    IF lw_string = 'SFR'.

      lo_attr = lo_node->get_attributes( ).



      CALL METHOD lo_attr->get_item

        EXPORTING

          index = 0

        RECEIVING

          rval  = lo_tipo_node.



    CALL METHOD lo_tipo_node->get_value

      receiving

        rval   = lw_string

        .





      CALL METHOD lo_tipo_node->set_value

        EXPORTING

          value = 'E'

        RECEIVING

          rval  = count.



    ENDIF.





    lo_node = lo_iterator->get_next( ).







  ENDWHILE.





lo_renderer1 = lo_ixml->create_renderer( ostream  = lo_ostream1

                                          document = lo_document ).

  lo_renderer1->render( ).

*Code to check how we write file in desktop.

  l_xml_size = lo_ostream->get_num_written_raw( ).



  CALL METHOD cl_gui_frontend_services=>gui_download

    EXPORTING

      bin_filesize = l_xml_size

      filename     = 'D:\WIP\flight2.xml'

      filetype     = 'BIN'

    CHANGING

      data_tab     = l_xml_table

    EXCEPTIONS

      OTHERS       = 24.


Viewing all articles
Browse latest Browse all 9024

Trending Articles



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