W3CDocument Formats Domain

W3C MathML Validator

MathML files may now be validated at the W3C Validator.

In order to validate a single MathML expression one may use the MathML DTD as specified in Appendix A of the MathML specification.

For example:

<!DOCTYPE math 
    PUBLIC "-//W3C//DTD MathML 2.0//EN"
           "http://www.w3.org/TR/MathML2/dtd/mathml2.dtd">
<math>
 <mn> 1 </mn> <mo> + </mo> <mn> 2 </mn>
</math>

To validate a whole series of MathML expressions it is easier to make an XHTML family document, also as described in appendix A:

<!DOCTYPE html PUBLIC
        "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
        "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
<title>MathML's Hello Square</title>
</head>

<body>

<p> This is a perfect square:</p>
<math xmlns="http://www.w3.org/1998/Math/MathML">
 <mrow>
   <msup>
     <mfenced>
       <mrow>
         <mi>a</mi>
         <mo>+</mo>
         <mi>b</mi>
       </mrow>
     </mfenced>
     <mn>2</mn>
   </msup>
 </mrow> 
</math>

<math> .... </math>

<math> .... </math>

</body>
</html>

These files may be submited to the W3C validator at http://validator.w3.org/.

However, at the time of writing the validator will only recognise them as MathML (and XML) if they are sent with the non standard mime type "mathml".

In the case of the XHTML document, a simple solution is to use the .html extension on your test file, but use the XHTML meta element to force the content type to be MathML.

The W3C validator does correctly raise an error with the following well formed document, as xxx is not a defined element:

<!DOCTYPE html PUBLIC
        "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
        "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
<title>MathML's Hello Square</title>
<meta http-equiv ="content-type" content="mathml" />
</head>

<body>

<p> This is a perfect square:</p>


<math xmlns="http://www.w3.org/1998/Math/MathML">
 <mrow><xxx/>
   <msup>
     <mfenced>
       <mrow>
         <mi>a</mi>
         <mo>+</mo>
         <mi>b</mi>
       </mrow>
     </mfenced>
     <mn>2</mn>
   </msup>
 </mrow> 
</math>

</body>
</html>

Maintained by: Angel Diaz (co-chair for the Math working group).
W3C contact for math: Dave Raggett. $Date: 2000/04/14 07:30:50 $

Copyright    2000 W3C (MIT, INRIA, Keio ), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public and Member privacy statements.

Valid HTML 4.0!    Valid CSS!