XML SET WHITESPACE-FLAGS

This statement has the following parameter:

Description

Parameter

Description

WhitespaceFlags

A numeric integer literal or an identifier of a numeric integer data item, the value of which is used to set the whitespace flags for XML Extensions.

WhitespaceFlags
The lixmldef.cpy file defines the following whitespace flags constant-names, which can be combined in various ways and have the described purpose.
  • WHITESPACE-DEFAULT-FLAGS (value 0) - No flags set, which is the default when XML Extensions is first initialized and after termination (in case another initialization is done). When the whitespace flags have the default value, no characters, including whitespace characters, are removed when importing data from an XML document into the COBOL data items. This constant-name can be used to set the flags back to their default value.
  • WHITESPACE-STRIP-CONTROL (value 1) - On import, strips all characters less than space, as in previous XML Extensions implementation, unless one of the preserve flags is set.
  • WHITESPACE-PRESERVE-TAB (value 16) - When stripping control characters, preserve any TAB characters for import.
  • WHITESPACE-PRESERVE-LF (value 32) - When stripping control characters, preserve any LF characters for import.
  • WHITESPACE-PRESERVE-CR (value 64) - When stripping control characters, preserve any CR characters for import. (Note that XML parsers normally translate any CR/LF sequences and any CR not followed by LF to a single LF; thus, CR characters are not normally present and cannot be preserved by this flag setting.)
  • WHITESPACE-NORMALIZE (value 65536) - On import, collapse any whitespace character sequences (space, LF, TAB or CR) to a single space character. The WHITESPACE-STRIP-CONTROL flag, if set, takes precedence over this flag and this flag, if set, will be ignored in that case.

The setting of the whitespace flags only affects imported data using the XML IMPORT FILE or XML IMPORT TEXT statements.

An example of a meaningful combination of these flags would be 49 as defined by:

78 WHITESPACE-PRESERVE-TAB-LF value
        WHITESPACE-STRIP-CONTROL +
        WHITESPACE-PRESERVE-TAB +
        WHITESPACE-PRESERVE-LF.

Example

XML SET WHITESPACE-FLAGS
 WHITESPACE-NORMALIZE.
IF NOT XML-OK GO TO Z.