
ENDIF.* Process the document IF l_parser->is_dom_generating( ) EQ ‘X’. WRITE: count, ‘ parse errors have occured:’. DATA: parseerror TYPE REF TO if_ixml_parse_error, str TYPE string, i TYPE i, count TYPE i, index TYPE i.

ENDIF.* Parse the stream IF l_parser->parse( ) NE 0. l_parser->set_validating( mode = if_ixml_parser=>co_validate ). PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.* wrap the table containing the file into a stream l_istream = l_streamfactory->create_istream_itable( table = l_xml_table size = l_xml_table_size ).* Creating a document l_document = l_ixml->create_document( ).* Create a Parser l_parser = l_ixml->create_parser( stream_factory = l_streamfactory istream = l_istream document = l_document ).* Validate a document IF pa_val EQ ‘X’. START-OF-SELECTION.* Creating the main iXML factory l_ixml = cl_ixml=>create( ).* Creating a stream factory l_streamfactory = l_ixml->create_stream_factory( ). PARAMETERS: pa_file TYPE char1024 DEFAULT ‘c:\temp\orders_dtd.xml’.* Validation of XML file: Only DTD included in xml document is supported PARAMETERS: pa_val TYPE char1 AS CHECKBOX. DATA: l_xml_table TYPE TABLE OF t_xml_line, l_xml_line TYPE t_xml_line, l_xml_table_size TYPE i. DATA: l_elem TYPE REF TO if_ixml_element, l_root_node TYPE REF TO if_ixml_node, l_next_node TYPE REF TO if_ixml_node, l_name TYPE string, l_iterator TYPE REF TO if_ixml_node_iterator. DATA: l_ixml TYPE REF TO if_ixml, l_streamfactory TYPE REF TO if_ixml_stream_factory, l_parser TYPE REF TO if_ixml_parser, l_istream TYPE REF TO if_ixml_istream, l_document TYPE REF TO if_ixml_document, l_node TYPE REF TO if_ixml_node, l_xmldata TYPE string. TYPES: BEGIN OF t_xml_line, data(256) TYPE x, END OF t_xml_line. *&-**& Report z_xit_xml_check*&-* REPORT z_xit_xml_check. As mentioned before the next log will focus on the use of SAP DOM within XI ABAP mapping. To upload the XML file, you need the filename and you have to declare an internal binary table to store the uploaded XML file. In the implementation we will explain the steps of the process and at the end of the log you will find a complete source sample. Next we will parse the stream to a XML DOM object using a using an iXML factory.Īnd finally we have a XML DOM Object and we can access its nodes to fill our table. We will start with an upload of a local XML file into a binary XML table and we will bind it to a XML input stream. In this weblog we will focus on retrieving data from a local XML file and store it in an internal table. This first part focused on the conversion of an ABAP table into an XML file and the last part will deal with the use of SAP DOM within XI ABAP mapping, introduced with SAP XI 3.0.

This document is the second-in-the-series and will focus on the conversion from a XML file (back) to an ABAP table. For this I split this weblog into three parts. My objective is to explain how you can use it in abap mapping. In this weblog I will focus on the possibilities of SAP XML Document Object Model (DOM) processing at the ABAP stack.
