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

sXML Library - Object-Oriented Rendering

Just as in token-based rendering, object-oriented rendering creates an XML writer. The nodes are not written, however, using a separate method for each node type, but using a single method, WRITE_NODE. This method is associated with a node object with the required node type using its input parameters and a corresponding node is appended to the current writer position.

Procedure (Principles)

As in token-based rendering, the XML writer is created using the factory method CREATE of the class in question, for example:

DATA(writer) = CAST if_sxml_writer( cl_sxml_string_writer=>create( ... ) ).

Before the node object is written, it can be created using one of the dedicated methods of the interface IF_SXML_READER, such as NEW_OPEN_ELEMENT, NEW_CLOSE_ELEMENT, and NEW_VALUE or it can be taken from another source, such as an object-oriented read, for example:

DATA(open_element) = writer->new_open_element( ... ).
writer->write_node( open_element ).
DATA(value) = writer->new_value( ).
value->set_value( ... ).
writer->write_node( value ).
DATA(close_element) = writer->new_close_element( ... ).
writer->write_node( close_element ).

The node object of an opened element has methods that can be used to insert XML attributes.

Example

See Object-Oriented Rendering.

Methods for Object-Oriented Rendering

The following methods of the interface IF_SXML_WRITER are designed specially for object-oriented rendering:

The values are written as in token-based rendering.

Notes

Examples