Develop > Application Configuration > CML reference > CML range attributes

CML range attributes

CML attributes define and control the semantics of a CML tag. This section defines the possible range attributes you can use in a CML template. For a given a CML type, range attributes allow you to define and restrict valid values for tag, using range specifiers.

! & , – Logical operators

! – not specifier

& – and specifier

, – or specifier

Syntax

@[{level}]{tag-type}[[{source}][;[{type}][;!{range}][;{option}[;{option}]...]]]]@ 
@[{level}]{tag-type}[[{source}][;[{type}][;{range}&{range}][;{option}[;{option}]...]]]]@ 
@[{level}]{tag-type}[[{source}][;[{type}][;{range},{range}][;{option}[;{option}]...]]]]@ 

Description

Range specifiers can be modified by logical operators to control how input is validated. The three available operators (in order of precedence) are: not, and, or.

  • The not operator is represented with an exclamation point, and is a prefix unary operator. It negates the meaning of the range, meaning that items that satisfy the range return false, and items that fail to satisfy the range return true.
  • The and operator is represented with an ampersand, and is an infix binary operator. It returns true if and only if both operands return true.
  • The or operator is represented with a comma, and is an infix binary operator. It returns true if and only if either operand returns true.

Whitespace is not significant when specifying ranges.

Note
The current CML parser requires that neither whitespace nor ‘@’ appear inside a CML tag.

n< n<= <n <=n =n – Comparison specifiers

n< – greater than specifier

n<= – greater than or equal specifier

<n – less than specifier

<=n – less than or equal specifier

=n – equal specifier

Syntax

@[{level}]{tag-type}[[{source}][;[{type}][;{number}<][;{option}[;{option}]...]]]]@

@[{level}]{tag-type}[[{source}][;[{type}][;{number}<=][;{option}[;{option}]...]]]]@

@[{level}]{tag-type}[[{source}][;[{type}][;<{number}][;{option}[;{option}]...]]]]@

@[{level}]{tag-type}[[{source}][;[{type}][;<={number}][;{option}[;{option}]...]]]]@

@[{level}]{tag-type}[[{source}][;[{type}][;={number}][;{option}[;{option}]...]]]]@

Description

The available specifiers for numeric values are: greater than, greater than or equal to, less than, less than or equal to, and equals.

A greater than specifier (n<) consists of a number, followed by an open angle bracket character. This range is satisfied by numeric values that are greater than the specified number.

A greater than or equal to specifier (n<=) consists of a number, followed by an open angle bracket character, followed by an equals character. This range is satisfied by numeric values that are greater than or equal to the specified number. (Note that for a number n, n<= is equivalent to !<n, and also equal to n<,=n, and is provided for convenience)

A less than specifier (<n) consists of an open angle bracket character, followed by a number. This range is satisfied by numeric values that are greater than the specified number.

A less than or equal to specifier (<=n) consists of an open angle bracket character, followed by an equals character followed by a number. This range is satisfied by numeric values that are greater than or equal to the specified number. (Note that for a number n, <=n is equivalent to !n<, and also equal to <n,=n, and is provided for convenience)

An equals specifier (=n) consists of an equals character, followed by a number. This range is satisfied by numeric values that are equal to the specified number.

It is suggested that when providing two range specifiers separated by an and operator, the greater than (or equal to) specifier precede the less than (or equal to) specifier, for example, 0<=&<256.

Whitespace is not significant when specifying ranges.

Note
The current CML parser requires that neither whitespace nor ‘@’ appear inside a CML tag.

" – String literal specifier

Syntax

@[{level}]{tag-type}[[{source}][;[{type}][;"{string}"][;{option}[;{option}]...]]]]@

Description

A string literal specifier consists of a double quote character, followed by a string of text, followed by a double quote character. The quoting and escaping rules follow those of the C language; that is, that embedded quotes are escaped with a backslash, a newline is represented by \n, a tab character is represented by \t, and a literal backslash is represented by \\. This range is satisfied by string values that exactly match the text.

Whitespace is not significant when specifying ranges.

Note
The current CML parser requires that neither whitespace nor ‘@’ appear inside a CML tag.

r" – Regular expression specifier

Syntax

@[{level}]{tag-type}[[{source}][;[{type}][;r"{regular expression}"][;{option}[;{option}]...]]]]@

Description

A regular expression specifier consists of the “r” character, a double quote character, followed by a regular expression, followed by a double quote character (“). The quoting and escaping rules follow those of Python regular expressions, with the exception of the quote character, which must be escaped with a backslash character. This range is satisfied by string values that match the regular expression.

Whitespace is not significant when specifying ranges.

Note
The current CML parser requires that neither whitespace nor ‘@’ appear inside a CML tag.