Displaying error messages

(Excerpt from "The MathML Handbook" by Pavi Sandhu)

The merror element displays its contents as an error message. It is intended as a way of displaying syntax errors encountered when an application is generating MathML from some other form of input. Each application can choose its own style for displaying the contents of the merror element so they are easy to distinguish from the surrounding text (for example, in a different color or with a different background).

The suggested use of the merror element is for an application to replace the erroneous part of the input with an merror element that contains a description of the error. The application then continues processing the surrounding input as normally as possible. This way, the error message appears at the location where the erroneous input would have appeared, making it easier to identify the cause of the error.

The merror element can contain any arbitrary MathML expression. Typically the text of the error message is enclosed in an mtext element. If the erroneous input contains fragments that are correctly formatted, then these can be processed normally and included in the contents of the error message.

For example, suppose a user includes the MathML element mssub instead of the MathML element msub because of a typing error, as shown in the following markup:

<mssub>
  <mi>&ExponentialE;</mi>
  <mrow>
    <mi>&ImaginaryI;</mi>
    <mi>&InvisibleTimes;</mi>
    <mi>&pi;</mi>
  </mrow>
</mssub>

When this markup is processed by an application that checks for MathML syntax, an error message like the following might be produced:

<merror>
  <mtext>Unrecognized element at line 17:mssub;arguments were:</mtext>
  <mi>&ExponentialE;</mi>
  <mtext>and</mtext>
  <mrow>
    <mi>&ImaginaryI;</mi>
    <mi>&InvisibleTimes;</mi>
    <mi>&pi;</mi>
  </mrow>
</merror>

   

<< back next >>

 

 

 

Tipp der data2type-Redaktion:
Zum Thema MathML bieten wir auch folgende Schulungen zur Vertiefung und professionellen Fortbildung an:
  • DocBook
  • DITA

 

Copyright © CHARLES RIVER MEDIA, INC., Massachusetts (USA) 2003
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "The MathML Handbook" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.


CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043, United States of America