invalid-data

rule

Syntax
invalid-data condition?
   action*


Purpose

A rule used to process erroneous input. The DTD restricts where the data content is permitted to occur in an SGML instance. The invalid-data rule is intended to process data content which violates these restrictions.

As with the selection of any other markup rule, the selection of an invalid-data rule is determined by the currently active groups and the condition, if any, on each invalid data rule in an active group. The %c operator is used in the body of the invalid-data rule to capture the data in question, and either it or the suppress action must be used (but only once).

If there are no invalid-data rules in an OmniMark program, and invalid data is encountered, then the marked-section ignore rules are examined as though the invalid data was the text of an ignore marked section.

OmniMark follows this procedure when invalid data is found:

  1. An error message is issued indicating that invalid data was found.
  2. The invalid data is either discarded or processed. If there is an invalid-data rule which can be performed, it processes the invalid data. If there are no invalid-data rules at all, it searches for a marked-section ignore rule to be performed, and processes the data. If there is no marked-section ignore rule, the data is discarded.

The following is an example of invalid data:

  <!doctype i [
  <!element i - o (a)>
  <!element a - o (#pcdata)>
  ]>
  
  <i>
  <a>
  
  
  You are about to see invalid data.
  </a>
  This is invalid data
  <? Did you see the invalid data >

The following is an example of an invalid-data rule:

  invalid-data
     put #error "Trashed: %"%c%".%n"