anchor.diff:      ENDIF.
   
       _raise 'Error while parsing XML'.
  -  ENDMETHOD.                    "error
  +  ENDMETHOD.
  +
  +ENDCLASS.
  +
  +CLASS lcl_xml_output DEFINITION FINAL INHERITING FROM lcl_xml CREATE PUBLIC.
  +
  +  PUBLIC SECTION.
  +    METHODS:
  +      add
  +        IMPORTING iv_name TYPE clike
  +                  ig_data TYPE any,
  +      render
  +        IMPORTING iv_normalize  TYPE sap_bool DEFAULT abap_true
  +        RETURNING VALUE(rv_xml) TYPE string.
  +
  +  PRIVATE SECTION.
  +    DATA: mt_stab TYPE abap_trans_srcbind_tab.
  +
  +ENDCLASS.
  +
  +CLASS lcl_xml_output IMPLEMENTATION.
  +
  +  METHOD add.
  +
  +    FIELD-SYMBOLS: <ls_stab> LIKE LINE OF mt_stab.
  +
  +    APPEND INITIAL LINE TO mt_stab ASSIGNING <ls_stab>.
  +    <ls_stab>-name = iv_name.
  +    GET REFERENCE OF ig_data INTO <ls_stab>-value.
  +
  +  ENDMETHOD.
  +
  +  METHOD render.
  +
  +    DATA: li_git  TYPE REF TO if_ixml_element,
  +          li_abap TYPE REF TO if_ixml_element.
  +
  +
  +    CALL TRANSFORMATION id
  +      SOURCE (mt_stab)
  +      RESULT XML mi_xml_doc.
  +
  +    li_abap ?= mi_xml_doc->get_root( )->get_first_child( ).
  +    mi_xml_doc->get_root( )->remove_child( li_abap ).
  +
  +    li_git = mi_xml_doc->create_element( c_abapgit_tag ).
  +    li_git->set_attribute( name = 'version' value = gc_xml_version ). "#EC NOTEXT
  +    li_git->append_child( li_abap ).
  +    mi_xml_doc->get_root( )->append_child( li_git ).
  +
  +    rv_xml = to_xml( iv_normalize ).
  +
  +  ENDMETHOD.
  +
  +ENDCLASS.
  +
  +CLASS lcl_xml_input DEFINITION FINAL INHERITING FROM lcl_xml CREATE PUBLIC.
  +
  +  PUBLIC SECTION.
  +    METHODS:
  +      constructor
  +        IMPORTING iv_xml TYPE clike
  +        RAISING   lcx_exception,
  +      read
  +        IMPORTING iv_name TYPE clike
  +        CHANGING  cg_data TYPE any
  +        RAISING   lcx_exception.
  +
  +  PRIVATE SECTION.
  +    METHODS: fix_xml.
  +
  +ENDCLASS.
  +
  +CLASS lcl_xml_input IMPLEMENTATION.
   
     METHOD constructor.
   
  -    CONSTANTS: c_version     TYPE string VALUE 'version' ##NO_TEXT,
  -               c_abapgit_tag TYPE string VALUE 'abapGit'.
  -
  -    DATA: li_stream_factory TYPE REF TO if_ixml_stream_factory,
  -          li_istream        TYPE REF TO if_ixml_istream,
  -          li_version        TYPE REF TO if_ixml_node,
  -          li_parser         TYPE REF TO if_ixml_parser.
  -
  -
  -    mi_ixml = cl_ixml=>create( ).
  -    mi_xml_doc = mi_ixml->create_document( ).
  -
  -    IF iv_xml IS SUPPLIED.
  -      li_stream_factory = mi_ixml->create_stream_factory( ).
  -      li_istream = li_stream_factory->create_istream_string( iv_xml ).
  -      li_parser = mi_ixml->create_parser( stream_factory = li_stream_factory
  -                                          istream        = li_istream
  -                                          document       = mi_xml_doc ).
  -      li_parser->set_normalizing( abap_false ).
  -      IF li_parser->parse( ) <> 0.
  -        error( li_parser ).
  -      ENDIF.
  -
  -      li_istream->close( ).
  -
  -      mi_root = mi_xml_doc->find_from_name( depth = 0 name = c_abapgit_tag ).
  -
  -      li_version = mi_root->if_ixml_node~get_attributes( )->get_named_item_ns( c_version ).
  -      IF li_version->get_value( ) <> gc_xml_version.
  -        display_xml_error( ).
  -      ENDIF.
  -    ELSEIF iv_empty = abap_false.
  -      mi_root = mi_xml_doc->create_element( c_abapgit_tag ).
  -      mi_root->set_attribute( name = c_version value = gc_xml_version ). "#EC NOTEXT
  -      mi_xml_doc->append_child( mi_root ).
  -    ENDIF.
  -  ENDMETHOD.                    "xml_root
  -
  -  METHOD display_xml_error.
  -
  -    DATA: lv_version TYPE string.
  -
  -
  -    lv_version = |abapGit version: { gc_abap_version }|.
  -
  -    CALL FUNCTION 'POPUP_TO_INFORM'
  -      EXPORTING
  -        titel = 'abapGit XML version mismatch'
  -        txt1  = 'abapGit XML version mismatch'
  -        txt2  = 'See https://github.com/larshp/abapGit/wiki/XML-Mismatch'
  -        txt3  = lv_version. "#EC NOTEXT
  -
  -    _raise 'XML error'.
  +    super->constructor( ).
  +    parse( iv_xml ).
  +    fix_xml( ).
   
     ENDMETHOD.
   
  -  METHOD table_add.
  -
  -    DATA: lv_name        TYPE string,
  -          li_table       TYPE REF TO if_ixml_element,
  -          lv_kind        TYPE abap_typecategory,
  -          lo_data_descr  TYPE REF TO cl_abap_datadescr,
  -          lo_table_descr TYPE REF TO cl_abap_tabledescr.
  -
  -    FIELD-SYMBOLS: <lg_line> TYPE any.
  -
  -
  -    lo_table_descr ?= cl_abap_typedescr=>describe_by_data( it_table ).
  -    lv_name = lo_table_descr->get_relative_name( ).
  -
  -    IF lv_name IS INITIAL.
  -      lv_name = iv_name.
  -    ENDIF.
  -
  -    IF lv_name IS INITIAL.
  -      _raise 'no name, table add'.
  -    ENDIF.
  -
  -    li_table = mi_xml_doc->create_element( lv_name ).
  -    lo_data_descr = lo_table_descr->get_table_line_type( ).
  -    lv_kind = lo_data_descr->kind.
  -
  -    LOOP AT it_table ASSIGNING <lg_line>.
  -      CASE lv_kind.
  -        WHEN cl_abap_typedescr=>kind_struct.
  -          structure_add( ig_structure = <lg_line>
  -                         ii_root      = li_table ).
  -        WHEN cl_abap_typedescr=>kind_elem.
  -          element_add( ig_element = <lg_line>
  -                       ii_root    = li_table ).
  -        WHEN OTHERS.
  -          _raise 'unknown kind'.
  -      ENDCASE.
  -    ENDLOOP.
  -
  -    xml_add( ii_root    = ii_root
  -             ii_element = li_table ).
  -
  -  ENDMETHOD.                    "table_add
  -
  -  METHOD xml_add.
  -
  -    IF ii_root IS BOUND.
  -      ii_root->append_child( ii_element ).
  -    ELSE.
  -      mi_root->append_child( ii_element ).
  -    ENDIF.
  -
  -  ENDMETHOD.                    "xml_add
  -
  -  METHOD element_add.
  -
  -    DATA: lo_descr   TYPE REF TO cl_abap_elemdescr,
  -          lv_string  TYPE string,
  -          li_element TYPE REF TO if_ixml_element,
  -          li_text    TYPE REF TO if_ixml_text,
  -          lv_name    TYPE string.
  -
  -    lo_descr ?= cl_abap_typedescr=>describe_by_data( ig_element ).
  -
  -    IF iv_name IS NOT INITIAL.
  -      lv_name = iv_name.
  -    ELSE.
  -      lv_name = lo_descr->get_relative_name( ).
  -      IF lv_name IS INITIAL.
  -        _raise 'no name, element add'.
  -      ENDIF.
  -    ENDIF.
  -
  -    li_element = mi_xml_doc->create_element( lv_name ).
  -
  -    lv_string  = ig_element.
  -    li_text    = mi_xml_doc->create_text( lv_string ).
  -
  -    li_element->append_child( li_text ).
  -
  -    xml_add( ii_root    = ii_root
  -             ii_element = li_element ).
  -
  -  ENDMETHOD.                    "element_add
  -
  -  METHOD element_read.
  -
  -    DATA: lo_descr   TYPE REF TO cl_abap_elemdescr,
  -          li_element TYPE REF TO if_ixml_element,
  -          lv_name    TYPE string.
  -
  -
  -    ev_success = abap_true.
  -
  -    lo_descr ?= cl_abap_typedescr=>describe_by_data( cg_element ).
  -
  -    IF iv_name IS INITIAL.
  -      lv_name = lo_descr->get_relative_name( ).
  -      IF lv_name IS INITIAL.
  -        _raise 'no name, element read'.
  -      ENDIF.
  -    ELSE.
  -      lv_name = iv_name.
  -    ENDIF.
  -
  -    li_element = xml_find( ii_root = ii_root
  -                           iv_name = lv_name ).
  -    IF NOT li_element IS BOUND.
  -      ev_success = abap_false.
  -      RETURN.
  -    ENDIF.
  -
  -    cg_element = li_element->get_value( ).
  -
  -  ENDMETHOD.                    "element_read
  -
  -  METHOD structure_add.
  -
  -    DATA: li_structure TYPE REF TO if_ixml_element,
  -          lv_name      TYPE string,
  -          lo_typedescr TYPE REF TO cl_abap_typedescr,
  -          lo_descr     TYPE REF TO cl_abap_structdescr.
  -
  -    FIELD-SYMBOLS: <ls_comp> LIKE LINE OF lo_descr->components,
  -                   <lg_any>  TYPE any.
  -
  -
  -    lo_descr ?= cl_abap_typedescr=>describe_by_data( ig_structure ).
  -
  -    IF iv_name IS INITIAL.
  -      lv_name = lo_descr->get_relative_name( ).
  -      IF lv_name IS INITIAL.
  -        _raise 'no name, structure add'.
  -      ENDIF.
  -    ELSE.
  -      lv_name = iv_name.
  -    ENDIF.
  -    li_structure = mi_xml_doc->create_element( lv_name ).
  -
  -    LOOP AT lo_descr->components ASSIGNING <ls_comp>.
  -      ASSIGN COMPONENT <ls_comp>-name OF STRUCTURE ig_structure TO <lg_any>.
  -      ASSERT sy-subrc = 0.
  -
  -      lv_name  = <ls_comp>-name.
  -      special_names( CHANGING cv_name = lv_name ).
  -
  -      lo_typedescr = cl_abap_typedescr=>describe_by_data( <lg_any> ).
  -      CASE lo_typedescr->kind.
  -        WHEN cl_abap_typedescr=>kind_table.
  -          table_add( it_table = <lg_any>
  -                     iv_name  = lv_name
  -                     ii_root  = li_structure ).
  -        WHEN cl_abap_typedescr=>kind_struct.
  -          structure_add( ig_structure = <lg_any>
  -                         iv_name      = lv_name
  -                         ii_root      = li_structure ).
  -        WHEN cl_abap_typedescr=>kind_elem.
  -          element_add( ig_element = <lg_any>
  -                       iv_name    = lv_name
  -                       ii_root    = li_structure ).
  -        WHEN cl_abap_typedescr=>kind_ref.
  -          CONTINUE.
  -        WHEN OTHERS.
  -          _raise 'unknown kind, structure add'.
  -      ENDCASE.
  -
  -    ENDLOOP.
  -
  -    xml_add( ii_root    = ii_root
  -             ii_element = li_structure ).
  -
  -  ENDMETHOD.                    "structure_to_xml
  -
  -  METHOD xml_render.
  -* will render to codepage UTF-16
  -
  -    DATA: li_ostream       TYPE REF TO if_ixml_ostream,
  -          li_renderer      TYPE REF TO if_ixml_renderer,
  -          li_streamfactory TYPE REF TO if_ixml_stream_factory.
  -
  -
  -    li_streamfactory = mi_ixml->create_stream_factory( ).
  -
  -    li_ostream = li_streamfactory->create_ostream_cstring( rv_string ).
  -
  -    li_renderer = mi_ixml->create_renderer( ostream  = li_ostream
  -                                            document = mi_xml_doc ).
  -    IF iv_normalize = abap_true.
  -      li_renderer->set_normalizing( ).
  -    ENDIF.
  -    li_renderer->render( ).
  -
  -  ENDMETHOD.                    "xml_render
  -
  -ENDCLASS.                    "lcl_xml IMPLEMENTATION
  +  METHOD fix_xml.
  +
  +    DATA: li_git  TYPE REF TO if_ixml_element,
  +          li_abap TYPE REF TO if_ixml_node.
  +
  +
  +    li_git ?= mi_xml_doc->get_root( )->get_first_child( ).
  +    li_abap = li_git->get_first_child( ).
  +
  +    mi_xml_doc->get_root( )->remove_child( li_git ).
  +    mi_xml_doc->get_root( )->append_child( li_abap ).
  +
  +  ENDMETHOD.
  +
  +  METHOD read.
  +
  +    DATA: lv_text  TYPE string,
  +          lx_error TYPE REF TO cx_transformation_error,
  +          lt_rtab  TYPE abap_trans_resbind_tab.
  +
  +    FIELD-SYMBOLS: <ls_rtab> LIKE LINE OF lt_rtab.
  +
  +
  +    ASSERT NOT iv_name IS INITIAL.
  +
  +    APPEND INITIAL LINE TO lt_rtab ASSIGNING <ls_rtab>.
  +    <ls_rtab>-name = iv_name.
  +    GET REFERENCE OF cg_data INTO <ls_rtab>-value.
  +
  +    TRY.
  +        CALL TRANSFORMATION id
  +          OPTIONS value_handling = 'accept_data_loss'
  +          SOURCE XML mi_xml_doc
  +          RESULT (lt_rtab).
  +      CATCH cx_transformation_error INTO lx_error.
  +        lv_text = lx_error->if_message~get_text( ).
  +        _raise lv_text.
  +    ENDTRY.
  +
  +  ENDMETHOD.
  +
  +ENDCLASS.
   
   *----------------------------------------------------------------------*
   *       CLASS lcl_time DEFINITION
  
positive.code: 
      DATA: ls_attr   TYPE w3tempattr,
            lv_source TYPE string,
            lo_xml    TYPE REF TO lcl_xml.
  
  
      IF lif_object~exists( ) = abap_false.
  
negative.code:     DATA mv_skip_testclass TYPE abap_bool.
  
      METHODS deserialize_abap
        IMPORTING io_xml     TYPE REF TO lcl_xml_input
                  iv_package TYPE devclass
        RAISING   lcx_exception.
  
      METHODS deserialize_textpool
        IMPORTING io_xml TYPE REF TO lcl_xml_input
        RAISING   lcx_exception.
  
      METHODS deserialize_docu
        IMPORTING io_xml TYPE REF TO lcl_xml_input
        RAISING   lcx_exception.
  
      METHODS serialize_abap
  