Comments
Comments are allowed in the prolog or query body. Comments do not affect query processing.
A comment is composed of a string that is delimited by the symbols
(:and :).
The following example is a comment in XQuery:(: A comment. You can use comments to make your code easier to understand. :)The following general rules apply to using comments in Db2 XQuery:
- Comments can be used wherever ignorable whitespace is allowed. Ignorable whitespace is whitespace that is not significant to the expression results.
- Comments are not allowed in constructor content.
- Comments can nest within each other, but each nested comment must
have open and close delimiters,
(:and:).
The following examples illustrate legal comments and comments that result in errors:
(: is this a comment? ::)is a legal comment.(: is this a comment? ::) or an error? :)results in an error because there is an unbalanced nesting of the symbols(:and:).(: commenting out a (: comment :) might be confusing, but is often helpful :)is a legal comment because a balanced nesting of comments is allowed."this is just a string :)"is a legal expression.(: "this is just a string :)" :)results in an error. Likewise,"this is another string (:"is a legal expression, but(: "this is another string (:" :)results in an error. Literal content can result in an unbalanced nesting of comments.