|
|||||
Rules | |||||
Prerequisite Concepts |
OmniMark is a primarily event-driven programming language. This means that OmniMark programs are largely made up of different pieces of code that are executed when certain events are encountered during the processing of an input document. The actions that the program executes, and the definition of the events that cause these actions to be executed, are defined in rules.
A rule is made up of two parts -- a rule header and a rule body.
In the rule header you define the event which, when encountered in an input document, will cause a certain action or set of actions to be executed. Rule headers are made up of two things: an event definition (usually a keyword followed by a name or pattern), and an optional condition which must be satisfied before the actions in the rule body are executed.
The rule body contains any number of local declarations and actions that are to be executed when the event in the rule header is encountered.
If the event defined in a rule header is encountered in an input document, and if the condition on that event is satisfied or evaluates to true, then the rule is said to "succeed", "be selected", "be triggered", or "fire". All this means is that the event in the input document has met all of the requirements defined in a particular rule header and, therefore, the actions in that rule body are executed.
If an event does not meet all of the requirements defined in a particular rule header, the rule simply "fails" and the actions in the rule body are not executed.
Rules can be placed into groups which can then be activated and deactivated anytime during the processing of an input document.
OmniMark currently provides the following types of rules:
data-content
document-end
document-start
dtd-end
dtd-start
element
epilog-start
external-data-entity
external-text-entity
find
find-end
find-start
invalid-data
marked-section cdata
marked-section ignore
marked-section include-end
marked-section include-start
marked-section rcdata
markup-comment
markup-error
process
process-end
processing-instruction
process-start
prolog-end
prolog-in-error
sgml-comment
sgml-declaration-end
sgml-error
translate
Prerequisite Concepts About OmniMark |
---- |