built-in data type
Every element event in a parsed markup stream is associated with an element-declaration
, which
contains all information that does not vary from one instance of the same element to the next.
An element-declaration
has the following properties:
Respectively, these can be obtained using the operators name of
element-declaration, attributes of
element-declaration, and
content of
element-declaration.
Every sgml-dtd
and xml-dtd
instance contains a shelf of type
element-declaration
, which can be obtained through the declared-elements of
operator.
This shelf is keyed by element name.
The following example program outputs names of all elements and their attributes declared by an SGML DTD:
define string source function attributes-of (value element-declaration d) as repeat over attributes of d as a output " " || key of a || "%n" again process do sgml-parse document creating sgml-dtds{"input"} scan #main-input suppress done repeat over declared-elements of sgml-dtds{"input"} as d output key of d || "%n" output attributes-of (d) again
Element declarations can be stored in shelves and passed to functions as arguments (as in the example above). When combined with the
create-element-event
operator, this allows for creation of new element events. The operator declaration of
performs the inverse operation and returns the original declaration from any markup-element-event
.