A tag (formally called an
) is defined as a structure in a document beginning with a
less-than symbol (<) and ending with a greater-than symbol
(>). Tags always begin with a name, which defines the nature of the tag, and can
optionally have a set of space-delimited
. Attributes are always described in the form of a
is an attribute name unique to that tag, and
is some arbitrary value
assigned to that attribute.
All of LXP's tags follow the same general structure of any mark-up language. Tags begin a
) with an
<tag>), and close each region with an associated slash-prefixed
tag (e.g., </tag>.
As with HTML and XML, some tags do not require closing. These are called
do not define a region, but perform a one-time operation. Empty element tags are typically characterized by a trailing
forward slash at the end of the tag (e.g., <tag />.
LXP's parser does not syntactically require trailing-slashes in empty element tags, though omitting them can cause
unpredictable behavior in some circumstances. For example, nesting the <include> tag
can cause some confusion to branching logic if trailing slashes are omitted. This is because the
<include> tag may be either an empty-element tag (as in the case of an external
document inclusion), or an opening tag requiring a closing tag (as in the case of the direct SQL inclusion).
Note: It is a good idea to be in the habit of using trailing slashes in empty-element tags. In HTML, some tags do not
formally require a trailing slash (e.g., <br> versus XHTML's
<br />). With the rise of XHTML and XML, however, requirements for
mark-up–based documents are becoming more strict.
Both opening and empty-element tags have names, and may also contain some number of attributes. While the name
describes the intent of a tag, the attributes typically define the
of the operation to be
performed, and vary in their meaning from tag to tag. A closing tag should only have a name, immediately following its
initial forward slash (e.g., </tag>).
LXP tag and attribute names are generally case-insensitive, though there are times when an attribute name refers
literally to a variable's name (such as in the <if> tag). In these instances, case
can matter, depending on the case conventions you use with your variables. The examples in this document prefer lowercase,
following the lead of the XHTML standard (which defines element names and attributes as all lowercase).
Example 13-6 shows a simple LXP mark-up region with one opening tag, one closing tag, and
two empty-element tags within their defined region.
Example 13-6. A Simple LXP mark-up region
<setvar example="test" />
<putvar name="example" />
LXP aims for simplicity and seamlessness in application development, and this basic structural aspect of LXP is an
example of this ethic.