swirl Guide to OmniMark 5   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesOMX VariablesErrors
 
  Related Syntax   Related Concepts  
rule type   markup-error    

Syntax

  markup-error condition?
     log?
     local-declaration*
     action*


Purpose

When the XML or SGML parser finds an error in the markup it is processing, OmniMark logs a markup error message and parsing continues. If you want to take control of reporting markup errors, you can write a markup-error rule.

The built-in variables #class, #error-code, #message, #additional-info, #recovery-info, #file-name, and #line-number provide data on the current error. You can use them to do your own error reporting. For example:

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

If you want to have OmniMark perform its own logging in addition to the error reporting you are doing yourself, use the log keyword in your markup-error rule:

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

If there is more than one markup-error rule in an OmniMark program, the first markup-error rule with no condition or a condition of "true" is performed.

Note that a markup error is not a program error. The occurrence of a markup error has no effect on the flow of your program, unless you cause that effect in a markup-error rule. Markup errors do not cause throws to #program-error or #external-exception. Note that if you throw out of a markup-error rule, this will abort the current parse.

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

  markup-error unless #class = 0

The parts of the error message produced by the SGML or XML parser are available in the markup-error rule in the following built-in local variables:

Warning (#class = 0) reports are always passed to markup-error rules, even if the "-warning" command-line option has not been used. The OmniMark program can ignore warnings by, for example, using the following condition:

  markup-error unless #class = 0

Specifying "log" in a markup-error rule has no effect on warning reports unless the command-line option "-warning" is given. The actions in the selected markup-error rule, however, will still be performed.

markup-error replaces sgml-error, which is now deprecated.

    Related Syntax
   #markup-parser
   log-message
 
Related Concepts
   Errors, markup (XML or SGML)
 
----

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ OMX ] [ OMX ] [ ERRORS ]

Generated: August 11, 2000 at 3:07:33 pm
If you have any comments about this section of the documentation, send email to docerrors@omnimark.com

Copyright © OmniMark Technologies Corporation, 1988-2000.