At any point in processing an SGML document instance, there is one or more element open starting with the document element. current elements provides shelf-like access to all of these elements and their attributes.
Like a shelf, the current elements stack is an ordered set of things (elements) with names.
It differs from a shelf in the following ways:
- An element can be opened more than once, so its "name" can occur more than once in the set of opened elements. As a consequence, an element is typically identified by a "relationship" to another element, such as
parent, ancestor, preparent, open element, or element, as well as, or instead of, its name.
- An opened element has a much more complex "value" than a
counter, switch, or stream shelf item or attribute.
- There is not one obvious ordering of opened elements as there is for shelf items or attributes (declared or specified). Either the first-opened or most recently opened can reasonably be considered to be the "first" element: there are cases in which OmniMark programmers need to examine the opened elements starting with the document element, and cases starting with the most recently opened one.
As a consequence of these differences between current elements and the shelf-like elements, different terminology is used. The relationship qualifiers are used to select an element instead of keys, the name of operation is used instead of key of, and a variant of number of is used instead of item of.
current elements makes a number of things easier:
- It makes it easy for a program to report where it is in processing a document.
current elements provides access to all the opened elements. This is especially useful when analyzing data prior to or while developing conversion programs. It also helps when debugging programs.
- There are many cases where the OmniMark element qualifier does not ask the exact question the programmer wishes to ask. Such cases can be dealt with by iterating over the currently opened elements to find one matching a nonstandard set of criteria, or to find whether such an element is open.
- More commonly, an OmniMark program may be required to do element qualifier-like tests based on dynamic information in the document being parsed. An example of this is ICADD and other HyTime-like applications. In these applications, attribute values can contain the names of other elements and element qualifier-like conditions or transformations, which can readily be implemented by stepping over the
current elements.
- The "address" of an element can be determined by stepping over
current elements and enquiring as to the occurrence of each opened element.
Generated: April 21, 1999 at 2:00:47 pm
If you have any comments about this section of the documentation, send email to [email protected]
Copyright © OmniMark Technologies Corporation, 1988-1999.