Creating an XML Handler using an XML Schema


   This tutorial will help you to understand:

 


1.        Launch XML Thunder

2.        The welcome screen will appear and give you two different options, one to Create a New XML Handler  and one to Open existing handlers.  (If you disabled the welcome screen, please click  toolbar or choose XML Handler -> New from main menu.). For now, click the first option.





3.        If the wizard starts with the Begin panel, click Next.





4.        On the Source panel, choose XML Schema from the list, click Next.

 

 

5.        On the next panel, type in the path to the tutorial Schema example BAXSD.xsd or click  to locate it. Click Next



6.        A list of available root elements will be displayed. Click on the item named: BANK and click Next.





7.        On the Names panel you should see the following screen.  Leave the names unchanged. Click Next

.

8.        On The IDS Design panel, choose the option to always keep the IDS and the XML design In-Sync





9.        On the Design View panel choose the IDS and XML design panes together option.





10.     On the Finish panel, review the information and click Finish.





11.     After few moments, the XML handler design window will be displayed. It should look like this:





12.     Before code generation, we will set the XML buffer size. Click XML Handler – Properties, switch to General pane and type 32000 in Buffer Size entry field. Click OK.




13.     Click Generate or select Tools -> Generate… from the main menu.


14.     On Generation dialog, adjust settings to generate a Writer, set the Program ID/Source Name to BAXSDW, set the destination folder, check the Generate IDS, set its Source Name to BAXSDWC and Generate .




15.     Upon normal completion, adjust settings to generate a Reader, set the Program ID/Source Name to BAXSDR, change the IDS Source Name to BAXSDRC option and click Generate .



16.     At the destination folder, you should now have BAXSDW.cbl, BAXSDR.cbl, BAXSDWC.cpy and BAXSDRC.cpy files, the XML Writer, Reader, Writer IDS and Reader IDS respectively. Main test programs BAXSDW_test.cbl and BAXSDR_test.cbl (located at Installation Folder/TutorTX/Main Test Programs), copy BAXSDWC and BAXSDRC and call BAXSDW and BAXSDR to demonstrate how an XML Writer and Reader can be used within a COBOL main program.


17.     Copy the following files to a temp folder:

BAXSDW_test.cbl
BAXSDR_test.cbl
BAXSDW.cbl
BAXSDR.cbl
BAXSDWC.cpy
BAXSDRC.cpy




18.     Launch your favorite COBOL IDE, load these files, compile them and run BAXSDW_test. It should produce BAXSDW.xml. Now let’s analyze the most important sections of the BAXSDW_test.cbl program.






19.     The generated XML file will look like:





20.     Run BAXSDR_test.cbl. It will read back the XML file. Let's take a look at the main section of this program.