Ansicht
Dokumentation

ABENABAP_IXML_LIB_RENDER - ABAP IXML LIB RENDER

ABENABAP_IXML_LIB_RENDER - ABAP IXML LIB RENDER

PERFORM Short Reference   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- Rendering

Note

When data is rendered as character-like XML data, this data is prefixed with the byte order mark (BOM) that is required by the XML standard.

Rendering a Full XML Document

An XML document in DOM representation is rendered using an XML renderer that can be created as follows using the iXML factory:

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

...

DATA(renderer) = ixml->create_renderer(
                   ostream        = ...
                   document       = ... ).

The static type of the reference variable renderer is then the interface IF_IXML_RENDERER. A separate renderer is needed for each XML document. The renderer requires the following input parameters:

  • The output stream ostream that is the target of the rendering.
  • The XML document document to be rendered.

A renderer created in this way can be used to render the entire XML document as follows:

renderer->render( ).

The rendered document is added to the data sink of the output stream.

Note

When the entire document is rendered, the data sink of the output stream should usually be initial beforehand. Otherwise, all the XML data is appended to existing content.

Rendering Individual Nodes

The interface IF_IXML_NODE also contains a method RENDER that allows only parts of an XML document to be rendered:

node->render( ostream = ...
              recursive = abap_true|abap_false ).

The subtree is rendered whose initial node is pointed to by the reference variable node. recursive is used to specify whether the subnodes are respected or not. The rendered subtree is added to the data sink of the output stream.

Notes

  • Using rendering of subtrees, XML data in the data sink of the output stream can be constructed from various parts.
  • There is no sequential rendering using events that would work in the same way as sequential parsing.

iXML Library - Render

Token Renderers

Instead of using CREATE_RENDERER to create a renderer for an XML document in DOM representation, a token renderer can be created as follows:

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

...

DATA(token_renderer) = ixml->create_token_renderer( ostream = ... ).

The static type of the reference variable token_renderer is then the interface IF_IXML_TOKEN_RENDERER. A token renderer only needs an output stream as an input parameter, but not an XML document in DOM representation. Instead, an internal table node_infos can be rendered as follows:

token_renderer->render( node_infos ).

The table node_infos must have table type SIXMLDOM with line type SIXMLNODE and contain all required information for constructing XML data. Each line in the internal table describes a token of the XML data. The meaning of the columns is described by the enumeration type CO_NI_ of the interface IF_IXML_TOKEN_PARSER

Note

An input table for the method RENDERER of the interface IF_IXML_TOKEN_RENDERER can be created separately or be created from XML data using a token parser and modified later.






rdisp/max_wprun_time - Maximum work process run time   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.

Length: 4910 Date: 20240419 Time: 095841     sap01-206 ( 84 ms )