XMLCOMMENT scalar function
The XMLCOMMENT function returns an XML value with a single comment node from a string expression. The content of the comment node is the value of the input string expression, mapped to Unicode (UTF-8).
The schema is SYSIBM.
- string-expression
- An expression that returns a value of a built-in character or
graphic string that is not a LOB and is not bit data. The result of string-expression is
converted to UTF-8 and then parsed to check for conformance to the
content of XML comment as specified by the following rules:
- '--' (double-hyphen) must not occur in the string expression
- The string expression must not end with a hyphen ('-')
- Each character of the string can be any Unicode character, excluding the surrogate blocks, X'FFFE', and X'FFFF'
The result of the function is an XML value that is an XML sequence that contains one XML comment node.
The result can be null; if the argument is null, the result is the null value.
Example: Generate an XML comment:
SELECT XMLCOMMENT('This is an XML comment')
FROM SYSIBM.SYSDUMMY1;
The result of the query
would look similar to the following result:
<!--This is an XML comment-->