ECN-4386 XML Extensions enhancements

Type of Change: Enhancement

Product: ACUCOBOL-GT

Module: runtime

New Version: 10.1.0

Machines Affected: All

DESCRIPTION:

There have been a number of enhancements to XML Extensions in this release of extend.

Controlling whitespace

The main change is the enhanced control over whitespace handling when importing a file. The default behavior has changed to preserve all whitespace elements, that is, space characters, line feeds (LF), carriage returns (CR) and tabs (TAB); previously, only space characters were preserved.

The introduction of two new library routines enables you to set non-default behavior: you can strip out all LF, CR and TABs as before, or any subset of these characters. You can also normalize whitespace, which replaces any consecutive sequence of whitespace characters with a single space.

See the documentation on XML SET WHITESPACE-FLAGS and XML GET WHITESPACE-FLAGS in the documentation for more details on how to control whitespace.

Addition information returned for non-successful operations

The XML GET STATUS-TEXT statement now obtains additional status lines for any errors or warnings. Each such line is now prefixed with [nn], where nn is the error or warning number that the extra line describes. This is particularly helpful when there are warnings and a fatal error for the same statement. The "Called from" line now includes this prefix as well. This additional information is provided for the import, export or input of document name, the ambiguous element name and its content, and the extraneous import element name and its content. The information will eliminate the need for using XML TRACE in many instances during or after development of a program that uses XML Extensions.

The XML GET STATUS-TEXT statement now obtains additional status lines for any errors or warnings. Each such line is now prefixed with [nn], where nn is the error or warning number that the extra line describes. This is particularly helpful when there are warnings and a fatal error for the same statement. The "Called from" line now includes this prefix as well. This additional information is provided for the import, export or input of document name, the ambiguous element name and its content, and the extraneous import element name and its content. The information will eliminate the need for using XML TRACE in many instances during or after development of a program that uses XML Extensions.

General XML TRACE improvements

There were several improvements made and defects fixed that concern the XML TRACE statement:

  • When a style sheet fails to load, and is then referenced a second time in the same program, a crash no longer occurs.
  • On UNIX, a failed transform to a memory document now frees the memory allocated for the transformed document. This matches the behavior on Windows.
  • Several possible buffer overruns when passed path-names or other user-provided strings too long for the internal buffers have been eliminated.
  • The XML TRACE statement no longer crashes if the file name provided cannot be opened, for example, when a path is specified for the trace file that does not exist, or the user does not have write permissions to the directory indicated; instead, the XML TRACE statement fails with a 73 error if the trace file cannot be opened.
  • An ambiguous import target data-name could cause XML Extensions to attempt a store outside the data area defined in the program for the import, thus causing memory corruption. Improvements in resolving ambiguous data-names now limit the possibility of this happening. If the situation does happen, the store outside the target data area is suppressed and an error 72 is returned for the XML IMPORT statement.

    Taking the following problem test case, the program defined a data-name twice, once within the target data item for the import and once outside the target data item. Import element qualification was not provided in this test case, but now XML Extensions uses its knowledge of the target data-name to implicitly qualify the element name; that is, only data-names subordinate to the target data-name are considered when resolving element names in the imported document to data-names in the importing program. When the target data-name itself is ambiguous, a -05 warning is produced. When the import element name is ambiguous (that is, matches more than one data-name defined subordinate to the target data-name), a -06 warning is produced. XML Extensions has also been changed to choose the lexically last definition of an ambiguous data-name, instead of the first.