Skip to main content

Problem:

Does an XML schema need to be present for a Net Express program to read an XML document?

Resolution:

The schema file does not need to be present in order for a Net Express program to read the XML document.     The schema file must be present only in the generation of the COBOL XML-enabled copyfile when using the CBL2XML tool.

CBL2XML creates the COBOL copybooks by using the data type and length information that are defined for the XML document within the schema file.  In this way an element described as "type=xsd:integer" in the document will be read into a numeric COBOL field etc.

CBL2XML does not have to be used to generate the copybooks. It is the most convenient and easiest method, but a programmer can code the entire XML record description by hand if they wish to.  However, they still must know the names and description of the elements within the file, or there will  be no meaningful way to process the information.

An XML document is only self describing if all the elements and Complex Types used are defined within the document itself.   The use of a Schema to define data type makes it easier to reuse the same data types in different documents, without having to define a new data type for each new document.

Old KB# 7043