Ansicht
Dokumentation

ABENABAP_IXML_LIB - ABAP IXML LIB

ABENABAP_IXML_LIB - ABAP IXML LIB

rdisp/max_wprun_time - Maximum work process run time   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

iXML Library

API of the iXML Library

iXML Library provides an API for handling XML documents in DOM format. This API enables

  • XML data to be parsed to DOM format,
  • reads and writes to be performed on XML documents in DOM format, including creating new documents,
  • XML documents in DOM format to be rendered to XML data.

In ABAP programs, the API is implemented using interfaces from the class library with the naming convention IF_IXML_.... The access class CL_IXML contains factory methods for creating basic objects such as streams, parsers, documents, and renderers. These objects are then accessed using interface reference variables. The classes and interfaces are documented in the Class Builder.

Notes

  • The classes and interfaces in iXML Library from the package SIXML wrap classes and interfaces implemented in C++ that are delivered as part of the ABAP kernel.
  • Standalone versions for C++ and C are also delivered, with the C version being a wrapper of the library implemented in C++.
  • iXML Library supports the Unicode character representation UCS-2. Characters from the surrogate area are not supported and can be rejected as invalid.

Access to iXML Library.

Precisely one factory object of the access class CL_IXML is required for accessing iXML Library in an ABAP program. This object is created as follows:

DATA(ixml) = cl_ixml=>create( ).

The static type of the reference variable ixml is then the interface IF_IXML, which contains all factory methods required to create further objects, such as streams, XML documents, parsers, or renderers. This factory object is a singleton and can only be instantiated once in an internal session.

Services in the iXML Library

The most important services offered by the classes and interfaces in iXML Library are as follows:

The XML parser analyzes the syntax of an XML file provided in an input stream to check whether it is correct and creates an XML document in a DOM representation from this file. This document can then be accessed using interfaces. The DOM can be created as follows:

The parser creates the XML document in a DOM representation for the complete XML data in a single action and places it in the memory.

The parser processes the input stream in sequential runs, where each sequence is determined by events that can be accessed using the interface IF_IXML_EVENT. The application can already process each sequence while the parser is running. It is possible to configure whether a complete XML documented is saved to DOM representation.

When parsing to data objects, the tokens of the parsed XML data is written directly to ABAP data objects (structures, internal tables). An XML document in DOM representation can also be saved.
An XML document represented as a DOM is in a standardized tree representation. For each logical unit of the XML document, there is a node object of an associated class that implements specialized interfaces. An ABAP program can use the interfaces to perform reads and writes to the XML document. The classes of the node objects are not usually used directly in the program.
The XML renderer creates XML data from an XML document saved as DOM. This document is created by parsing with and without subsequent modifications, or created as a complete new document using the methods of the DOM interface. The renderer then passes the data to an output stream.

Notes

  • One benefit of DOM is very simple access to the individual parts of an XML document. It also has the drawback, however, of increased memory consumption, which can be up to ten times the actual size of the document. It should be noted that the document itself can already use more memory for its markup than for the actual data. This memory consumption can be restricted by preventing a complete DOM from being created by sequential parsing or by parsing to data objects.
  • The DOM in iXML Library also includes DTDs (Document Type Definitions).
  • If XML data needs to be parsed and rendered only and no XML documents in DOM representation and no DTDs are needed, sXML Library provides an alternative with better performance than iXML Library.
  • iXML only supports the XML 1.0 format, where XML data is represented by a particular character format using a character string. sXML Library supports more formats.
  • When data is rendered as character-like XML data, this data is prefixed by the byte order mark (BOM) that is required by the XML standard.





Addresses (Business Address Services)   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 8005 Date: 20240420 Time: 155213     sap01-206 ( 106 ms )