Defining Dynamic Components of HTML Pages

Two mechanisms, both part of the HTML 4.0 specification, are used to identify elements (tags) for the creation of dynamic content. The id attribute, valid on most elements, is a document-unique identifier of a particular element. Elements maybe grouped using the the class attribute. The class name can then be used to find multiple elements on which to perform an operation. A given element may belong to multiple classes by giving multiple class attributes. While both of these attribute are defined in HTML 4.0, most HTML software ignores attributes that are not understood and their use does not cause problems. Examples of these attributes are:

    <input type="text" name="username" id="username">

    <tr class="deleteRow">

These identifiers serve as the formal interface between the designer of a document and the programmer writing code to generate dynamic content from that page. By the designer and programmer carefully working out the identifiers, both may proceed with full development in parallel.

The use of these the id and class attributes does not conflict with other uses, such as access by JavaScript. All an id does it give that element a unique name, it does not define the usage, the same id can be accessed from both JavaScript and with XMLC-generated objects. The class attribute is a white-space separated list of names, so it possible for an element to belong to more than one class.

Identifying Elements for Modification

The main reasons for giving element unique identifiers using the id attribute are: When one wants to modify text embedded in a block of text, the HTML 4.0 <span> tag with an id attribute maybe used to access a portion of text within a larger text block.

Element Grouping

Some of the useful reasons for grouping multiple elements using the class attribute are:

URLs

Since one goal of XMLC is to allow the HTML pages to remain a working mockup, URLs must reference static HTML pages, rather than reference dynamic content generators, like servlets. However, its is not necessary to individual identify each element that has a URL that needs updated. This can be done a XMLC compile-time using the -urlmapping, -urlregexpmapping, or -urlsetting option.