Before any other XML statement may be executed, the XML INITIALIZE statement must be successfully executed. Since it is possible for XML INITIALIZE to fail, the return status must be checked before continuing.
In this example, three different predefined XML documents are processed:
The x-addressa1.xml file is not well-formed and will cause the XML TEST WELLFORMED-FILE statement to return with an error status. Since this function fails, the XML VALIDATE FILE statement is not used to process this file.
The x-addressa2.xml file is well-formed but not valid. The XML TEST WELLFORMED-FILE statement will return success. The XML VALIDATE FILE statement will return with an error status.
The x-addressa3.xml file is both well-formed and valid. Both the XML TEST-WELLFORMED-FILE statement and the XML VALIDATE FILE statement will return a successful status.
Finally, the XML interface is terminated with the XML TERMINATE statement.
If any of the statements terminate unsuccessfully, the XML GET STATUS-TEXT statement is called.