Retrieving Data

To retrieve data from an element, you use the CXML-GET-DATA op-code. In this operation, you must specify the handle for the element of interest, down to the field level. You can obtain the handle by looking at the return code for the other operations, such as CXML-GET-SIBLING-BY-NAME. For example:

*Get the handle for the Weather element 
   call "C$XML" using CXML-GET-SIBLING-BY-NAME 
                   ele-1-handle 
                   "weather" 
                   0. 
   move return-code to ele-2-handle. 
*Get the weather data using that handle 
   call "C$XML" using CXML-GET-DATA 
                   ele-2 handle 
                   throw-away-info 
                   weather-val.

Once the XML data is returned, you can then pass it to other parts of your COBOL program for processing or display.