rule
markup-error condition? log? local-declaration* action*
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.
markup-error
rules are not affected by rule group
selection.
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.
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:
#error-code
#class
#message
#additional-info
#recovery-info
#file-name
#line-number
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.