Tag Parsing

When a tag is parsed, its attributes are read in one of two ways—literally, or interpretively. Similar to existing conventions in a variety of languages, defining a value in single-quotes (e.g., name='value') causes the contents of the value to be parsed literally, regardless of the characters between quotes. Using double-quotes causes its contents to be parsed interpretively, meaning that some characters will be treated in special ways.

Specifically, these special characters are the dollar sign ($), the at sign (@), and the ampersand (&). These characters correspond to variable substitution, object variable value substitution, and entity substitution, respectively.

Value substitution is the process by which a variable, cookie, object, or entity’s value is substituted for its syntactically referenced name. This occurs at the name’s original location in any arbitrary string of characters.

Variable Substitution

What may be confusing to experienced programmers at first is that LXP supports the familiar dollar sign notation to substitute a named variable (e.g., $myvariable) with its associated value in a mixed character string.

When using LXP, it is important to understand the contexts in which variables are substituted (and the context in which they are not). Subsequently, it is also important to understand when to use variable substitution and when not to.

The first rule is that variables will never be substituted outside of an LXP tag. Example 13-9 attempts incorrectly ...

Get Practical PostgreSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.