A
variable
is a modifiable value in memory that is accessed through an associated name. This name
is used to identify, and subsequently utilize in some fashion, the value that it represents. The specific use varies based on
the LXP tag employed.
LXP also implements a special type of data structure called an
object
. An LXP object is typically
used to identify several associated variable values through a common name. The particular value you wish to address in an LXP
object is identified either by a trailing subscript (a numeric or text value, in square brackets, such as
example[0]) or a dot-notated trailing identifier (such as
for.count).
The concept of an LXP object is similar to the programmatic concept of arrays and objects in traditional programming
languages, though LXP objects are generally much simpler in their nature. In practice, the only difference between variables
and objects is syntactic, having to do with how values are identified. Variables are identified with a plain name (e.g.,
my_value), while objects are identified by a name and a secondary identifier (e.g.,
my_value[0], my_value[1], my_value.size).
From a programmer's perspective, variables and objects are considered
global
, meaning that once
set, they are available anywhere in a document. Included documents will also have access to the variables which are set in
memory.