Ansicht
Dokumentation

ABENSXML_PARSING_METHODS_ABEXA - SXML PARSING METHODS ABEXA

ABENSXML_PARSING_METHODS_ABEXA - SXML PARSING METHODS ABEXA

General Material Data   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- Methods for Token-Based Parsing.

This example demonstrates how various methods are used in token-based parsing.

Source Code

Execute

Description

A string of XML data is parsed multiple times:

  • In the first parsing, all data is read as usual in a nested loop using the methods NEXT_NODE and NEXT_ATTRIBUTES.
  • In the second parsing, the method PUSH_BACK is used to reset the parser to the element opening for each value node with a specific value and to read the attributes here.
  • The third parsing demonstrates various ways of reading XML data.
  • First, a specific attribute is read for an element with a specific name using GET_ATTRIBUTE_VALUE.

  • Then an iteration runs across all attributes of all elements without evaluating the elements until a specific value occurs. If the value occurs, the method CURRENT_NODE is used to reset the parser to the start of the current attribute list and the list is evaluated.

  • Finally, the method NEXT_ATTRIBUTE_VALUE is used to read the value of each attribute as raw data stored in Base64 format. The data is displayed only if this is successful.

  • In the fourth and fifth parsings, the method SKIP_NODE demonstrates why the hierarchy level of the current node is saved in the helper variable level.
  • In the first case, the element opening of subitems is exited using SKIP_NODE. The entire subtree introduced using subitems is parsed and placed in an XML writer. The results are then displayed.

  • In the second case, the element openings of all subelements of subitems are exited and these are parsed and their content is placed in an XML writer. These elements are located at the same level, which means the associated element opening and the end of element must be added to the writer explicitly.






Fill RESBD Structure from EBP Component Structure   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 2707 Date: 20240419 Time: 025908     sap01-206 ( 43 ms )