Get Example source ABAP code based on a different SAP table
ABAP_IXML - Complete Parse to DOM To parse XML data to a DOM> representation in a single action, a parser> created for this purpose 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 provide the result that match the following constants from the type pool 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 anymore. If the parsing is successful, the XML document document>> linked with the parser can be used to access the DOM > stored in the memory.
Latest notes:
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 class CL_DEMO_XML_ATTRIBUTES>>).
An alternative for complete parsing of XML data to the DOM> representation is to call the identity transformation> ID> with CALL TRANSFORMATION>>. See the executable example DOM Representation>. No streams and factories need to be created explicitly here. ABAP_HINT_END
Example ABAP Coding
Creates a parser for an input stream for a text string and parses it to an XML document. ABEXA 01481 ABAP_EXAMPLE_END