CXML-GET-PARENT

Syntax:

CALL "C$XML" USING CXML-GET-PARENT, handle

Parameters:

CXML-GET-PARENT Op-code 5. Numeric data item that specifies the operation to perform. Each operation is defined in acucobol.def, which is included with your system.
handle USAGE handle

On Entry:

CXML-GET-PARENT Value 5
handle An element handle.

On Exit:

RETURN-CODE Contains the handle of the parent element of that element, or 0 if this is the top-level element or some other error.

Comments:

This operation enables you to go through the XML tree without keeping track of all the handles received from C$XML. It is also a way to move backwards in an XML file. This op-code does not retrieve element data. It simply moves to the element and returns the element handle. Once you have the handle to the element of interest, you can call CXML-GET-DATA to retrieve the data associated with the element.

Example:

working-storage section.
01 parser-handle usage is handle.
01 element-handle usage is handle.
COPY "acucobol.def".
procedure division.
main-logic.  
*Get Parent element 
   call "C$XML" using CXML-GET-PARENT, element-handle
   move return-code to parent-handle