CXML-ADD-CHILD

Syntax:

CALL "C$XML" USING CXML-ADD-CHILD, handle, elem-name, elem-data, data-len

Parameters:

CXML-ADD-CHILD Op-code 27. 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
elem-name Literal or pic x(n)
elem-data

Optional

Literal or pic x(n)
data-len

(Optional)

Numeric literal or pic x(n)

On Entry:

CXML-ADD-CHILD Value 27
handle An element handle.
elem-data (Optional) The value of the new child element. By default, this is blank.
data-len (Optional) The length of the new child element. If omitted, it defaults to the size of the data item.

On Exit:

RETURN-CODE A handle to the new child element.

Comments:

This operation adds a new child element to the list of children already in the specified element. The new element will be the last in the list.

Example:

working-storage section.
01 parser-handle usage is handle.
01 element-handle usage is handle.
COPY "acucobol.def".
procedure division.
main-logic.  
*Create a new XML file 
   call "C$XML" using CXML-NEW-PARSER
   move return-code to parser-handle.  
 
*Add a top element (using the name of the file)
   call "C$XML" using CXML-ADD-CHILD 
                  parser-handle
                  "custRec" 
   move return-code to element-handle.  
                     
*Add the first field of the record, which will be a child of 
*the last element.
   call "C$XML" using CXML-ADD-CHILD 
                  element-handle
                  "cus-key"
                  "555-55-5555"
   move return-code to element-handle.