Skip to main content

HTML Guide

Bad value https://www.w3.org/1998/Math/MathML for the attribute xmlns (only http://www.w3.org/1998/Math/MathML permitted here).

Use the MathML namespace with http:// (not https://) in the xmlns value.

Explanation

The xmlns attribute defines an XML namespace. For MathML in HTML or XHTML, the only permitted namespace URI is:

  • http://www.w3.org/1998/Math/MathML

Using https:// is not equivalent and fails validation. In HTML5, embedded MathML typically doesn’t set xmlns on <math>; the parser assigns the MathML namespace automatically. In XHTML or XML contexts, xmlns="http://www.w3.org/1998/Math/MathML" is required on the <math> element (or inherited from an ancestor).

HTML examples

Reproducing the issue (invalid https:// namespace)

<!DOCTYPE html>
<html lang="en">
<head>
  <title>MathML Invalid Namespace</title>
</head>
<body>
  <math xmlns="https://www.w3.org/1998/Math/MathML">
    <mi>x</mi><mo>+</mo><mn>1</mn>
  </math>
</body>
</html>

Fix in HTML5 (omit xmlns; let HTML set the namespace)

<!DOCTYPE html>
<html lang="en">
<head>
  <title>MathML Correct in HTML</title>
</head>
<body>
  <math>
    <mi>x</mi><mo>+</mo><mn>1</mn>
  </math>
</body>
</html>

Fix in XHTML/XML (use the exact http:// URI)

<!DOCTYPE html>
<html lang="en">
<head>
  <title>MathML Correct in XHTML/XML</title>
</head>
<body>
  <math xmlns="http://www.w3.org/1998/Math/MathML">
    <mi>x</mi><mo>+</mo><mn>1</mn>
  </math>
</body>
</html>

Learn more:

Related W3C validator issues