contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
Down-translation: translating XML/SGML documents
Prerequisite Concepts   Sample Code   Related Syntax  

A down-translation is a translation whose input is either an XML document, or a complete SGML document or an SGML document instance corresponding to a specified Document Type Definition.

The output of a down-translation can be XML/SGML or some other format. It could be a document suitable for input into a text formatter, for example, or a down-translation can be used to enter information from the XML/SGML document into a database. A down-translation can even be used to transform an XML/SGML document into another XML/SGML document, for instance by "cleaning up" the input or by restructuring it.

A down-translation is defined by entering down-translate at the beginning of the program.

A down-translation is composed of rules that recognize XML/SGML events, like elements. The basic operation of a down-translate program is:

  1. The XML/SGML parser builds up information as it processes the input document.
  2. When the XML/SGML parser recognizes a new component in the document, (an element or a processing instruction, for example), it informs OmniMark.
  3. OmniMark then examines each rule in the program, in order, looking for rules that apply to that event. It selects the first such rule that has no condition or with a condition that is true.
  4. OmniMark executes all of the actions in the selected rule in order.
  5. Control is returned to the XML/SGML parser so that more input can be processed, and the cycle begins again.

If the component found is one that has content, such as an element or an XML/SGML comment, then the actions in the rule control when the content is processed. The content is processed when a %c or suppress action is encountered.

Should the XML/SGML parser detect any errors in the markup of the XML/SGML document, it will report the errors. The OmniMark program can customize the manner in which these errors are reported.

The XML/SGML parser will always recover from a markup error and return meaningful information to OmniMark, allowing processing to continue. Because of this, as many errors as possible will be detected in one run of the program.

When the content of a component is processed by a rule, that rule is temporarily suspended. Events within the component's content (such as subelements) can cause other rules to execute. When the content has been completely processed, the suspended rule is resumed, and the remainder of the actions are executed. This behavior gives the execution of an OmniMark program the same hierarchical structure as an XML/SGML document.

Care must be taken with programs written for earlier releases of OmniMark, which didn't support programs without a translation type. For the earlier releases, a program without a translation type was assumed to be a down-translate. If the program cannot be modified to add the translation type, then the current releases of OmniMark can still be made to process such programs correctly using the -herald command-line option.

Because OmniMark rules are defined in terms of comment structure rather than markup in a down-translation, output is not affected by markup minimization, or ignored record ends in the XML/SGML source document. Unless the program has rules for comments and marked sections, they do not affect the output.

The predominant rule in a down-translation is the element rule. An XML/SGML element is described as the part of the document that spans from the beginning of a start tag to the end of the corresponding end tag for a particular element name. Elements may contain text, entity references, processing instructions, and more elements, thus forming a hierarchy.

It is the OmniMark programmer's task to identify the elements which may occur in an XML/SGML document and set up a rule for each one. The elements which may occur are identified by examining the Document Type Definition. The OmniMark programmer may define more than one rule for any one element. In this case, the programmer must specify the conditions or qualifications under which the rule becomes relevant.

Prerequisite Concepts
     Aided translation types
 
Sample Code
   Down translations: a simple example
   SGML to HTML conversions
 
Related Syntax
   down-translate
 
----

Top [CONTENTS] [CONCEPTS] [SYNTAX] [LIBRARIES] [SAMPLES] [ERRORS] [INDEX]

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.