sgml-error
Full Description
swirl
Syntax
  sgml-error condition?
     log?
     local-declaration*
     action*


Purpose

A rule triggered when an SGML parsing error is found by the SGML parser. The OmniMark program can do several things in an sgml-error rule.

sgml-error is a deprecated form of the markup-error rule.

This rule is used as follows:

  • It can report the error in a manner suited to the task it is performing.
  • It can put text to the #sgml stream in up-translations and context-translations to help recover from the error (although this is usually unnecessary and may create more errors).
  • It can examine the error and determine (for example, by checking whether the number of errors has reached a threshold value) if the OmniMark program should stop processing (although there is a command-line option that automates this in simple cases).

If the log keyword is specified at the beginning of the rule body, conventional error reporting is done in addition to the actions that follow.

If there is more than one sgml-error rule in an OmniMark program, the first sgml-error rule with no condition or a condition of "true" is performed. If there are no sgml-error rules that can be performed, conventional error reporting is done.

When the document instance has SGML errors, the programmer can still obtain control in the document-end rule or in the do sgml-parse action to determine how to complete the processing. This allows the program to "clean up properly" while still reporting as many errors as possible before terminating the parsing of the current document.

This SGML error rule instructs OmniMark to report an error in the usual fashion. It also outputs the fixed and variable parts of the error message, as well as its line number, in a form that can be accessed by other software. If the variable part of the message is not available, it is not provided.

  sgml-error
    log
    output "\message{%g(#message) on line %d(#line-number)"
    output "%n%g(#additional-info)"
           when #additional-info is attached
    output "}"

#class = 0 reports are always passed to sgml-error rules, even if the -warnings command-line option has not been used. This sample shows how to modify OmniMark to ignore these warnings.

Note that specifying log in an sgml-error rule has no effect on warning reports unless the command-line option "-warning" is included.

  sgml-error unless #class = 0

Copyright © OmniMark Technologies Corporation, 1988-1998.