ABAP Keyword Documentation →  ABAP − Reference →  Data Interfaces and Communication Interfaces →  ABAP and XML →  Class Libraries for XML →  sXML Library → 

sXML Library - Formats

The formats supported by sXML Library are represented by the constants of the interface IF_SXML:

Standard XML in accordance with W3C. XML data is represented in a specific character format using a character string (standard is Unicode character format UTF-8). Raw data whose binary content is to be saved is portrayed using Base64 representation.
XML-binary Optimized Packaging in accordance with W3C. All data other than raw data is represented as a character string, as in XML 1.0. Raw data is not represented as part of the character string in Base64 format. Instead, elements xop:Include (namespace http://www.w3.org/2004/08/xop/include) are inserted in its place, which contain references to the raw data. The raw data itself is extracted unchanged and saved in byte strings. The string with the character string and the byte strings with the raw data are combined in a package whose parts can be edited together. In sXML Library, a package of this type is described using the structured type IF_SXML_XOP=>XOP_PACKAGE, whose first component XOP_DOCUMENT has the type string for the character string. The second component PARTS is a hashed table for the byte strings. The key column CONTENT_ID is the reference target for the references in the xop:Include elements. The column BINARY_DATA has the type xstring and the raw data is passed to this column.
SAP-specific binary format for XML data. It suppresses redundant information. The XML data is not represented as globally readable character strings and the only character set allowed is UTF-8. Special XML readers and XML writers that understand the format are needed to parse and render XML data to Binary XML. sXML can be used to create these objects.
JavaScript Object Notation in accordance with json.org. JSON is not XML but JSON data can be represented using XML data. Once mapping of this type is the SAP-specific JSON-XML. The format JSON in sXML Library indicates that an XML writer of this format transforms valid JSON-XML data to JSON data and an XML reader detects JSON data and parses it as if it were JSON-XML data. All methods for handling JSON in ABAP are based on readers and writers like these.

When an XML writer is created, the format created by the writer is defined as follows:

When an XML reader is created, it detects the format of the data passed to the parameter INPUT of the factory method CREATE. The same reader classes can be used for all formats except XOP. Only the special class CL_SXML_XOP_READER can be used for the XOP format. The factory method CREATE of this class expects an actual parameter of the type IF_SXML_XOP=>XOP_PACKAGE.

Notes

Examples

See XML Formats and Transformation of Formats.