skip to main content

Library Routines : C$XML

C$XML
The C$XML routine allows to deal with XML documents. It allows to parse documents and change their content as well as create new documents from scratch.
When writing content to the XML document, the following data conversion rules are applied:
Syntax:
 CALL "C$XML" USING opCode 
             GIVING returnCode
Parameters:
Return code:
The definition and meaning of the returnCode depend on the opcode.
Examples:
Example - Read the content of file.xml and show it on the console.
       working-storage section.
       copy "iscobol.def".
       77  xml-handle                          handle.
       77  elem-handle                         handle.
       77  xml-item-name                       pic x(32).
       77  xml-item-value                      pic x(32).
       77  attr-count                          pic 99.
       77  i                                   pic 99.
       77  attr-name                           pic x(32).
       77  attr-value                          pic x(32).
       procedure division.
           call "c$xml" using cxml-parse-file
           call "c$xml" using cxml-get-first-child
           perform until 1 = 2
             call "c$xml" using cxml-get-data
             display "elem. name: " xml-item-name
             display "elem. value: " xml-item-value
             call "c$xml" using cxml-get-attribute-count
             display "attr. count: " attr-count
             if attr-count > 0
                perform varying i from 1 by 1 until i > attr-count
                  call "c$xml" using cxml-get-attribute
                  display "attr. name: " attr-name
                  display "attr. value: " attr-value
             call "c$xml" using cxml-get-next-sibling 
             if elem-handle = 0
             end-if                    
           call "c$xml" using cxml-release-parser
           accept omitted.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left