Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Data Interfaces and Communication Interfaces →  ABAP and XML →  Class Libraries for XML →  iXML Library →  iXML Library - Parsing 

iXML Library - Complete Parse to DOM

To parse XML data to a DOM representation in a single action, a dedicated parser is used as follows:

DATA(rc) = parser->parse( ).

Here, parser is a reference variable that points to the parser. The parser checks whether the XML data of the input stream istream is correct and creates a DOM representation of this file in the memory. The return value of the method PARSE has the type i and uses values to produce the result that match the following constants from the type group IXML:

  • ixml_mr_parser_ok
    The parsed XML data does not have any errors. Parsing was successful and all XML data is available in the saved XML document.
  • ixml_mr_parser_error
    The parsed XML data has errors. Although the parser created a valid DOM from the XML file with the errors, it does not usually contain all the XML data. These errors can be analyzed.
  • ixml_mr_parser_fatal_error
    The XML data could not be parsed at all. This error does not usually occur any more.

If the parsing is successful, the XML document document associated with the parser can be used to access the DOM saved in the memory.

Other versions: 7.31 | 7.40 | 7.54


  • If an XML element has multiple attributes with the same name, only one of these attributes is passed to DOM, which is given the value of the last identically named attribute (see example program DEMO_XML_ATTRIBUTES).


Creates a parser for an input stream for a text string and parses it to an XML document.

DATA(ixml)           = cl_ixml=>create( ).
DATA(stream_factory) = ixml->create_stream_factory( ).

DATA(istream)        = stream_factory->create_istream_string(
  `<?xml version="1.0"?>`         &&
  `  <text>`                      &&
  `    Mer lasse de DOM in Kölle` &&
  `  </text>` ).

DATA(document)       = ixml->create_document( ).
DATA(parser) = ixml->create_parser(
                         stream_factory = stream_factory
                         istream        = istream
                         document       = document ).

DATA(rc) = parser->parse( ).

IF rc <> ixml_mr_parser_ok.
  ... "Error handling