sapdev logo background
sapdev logo sapdev logo
Comments

SAP SXML PARSING METHODS ABEXA documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

sXML Library, Methods for Token-Based Parsing
This example demonstrates how various methods are used in token-based parsing .

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
A string of XML data is parsed more than once:
  • 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 move the parser back to the opened element 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 move 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 saved 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 opened element of subitems is exited using

  • SKIP_NODE . The full subtree introduced using subitems is parsed and moved to an XML writer. The results are then displayed.
  • In the second case, the opened elements of all subelements of

  • subitems are exited. They are parsed and their content is moved to an
    XML writer. These elements are located at the same level, which means the associated opened element and the closed element must added to the writer explicitly.
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    SXML_PARSING_ABEXA
    SXML_PARSING_STEPS_ABEXA




    comments powered by Disqus