This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
Mathematica Import/Export Format

XHTMLMathML (.html, .htm, .xhtml, .xht, .xml)

Registered MIME type: application/xhtml+xml
XHTML with embedded MathML.
Plain text XML format.
Describes the structure and aspects of the appearance of web pages, including typeset mathematical formulas.
  • Import fully supports XHTML versions 1.0 and 1.1.
  • Export generates documents conforming to XHTML 1.1 and MathML 2.0.
  • Import["file.xhtml"] gives a plain text representation of an XHTML+MathML file.
  • Import["file.xhtml", "Data"] extracts tabular data from XHTML+MathML.
  • Export["file.xhtml", expr] creates an XHTML+MathML version of expr.
  • Export["dir", expr] translates expr to XHTML+MathML, saving the output in the specified directory.
  • Import["file.xhtml"] returns a string, representing the textual content of the file as formatted plain text.
  • Export["file.xhtml", expr, "XHTMLMathML"] exports a notebook, a cell, a list of cells, or other notebook elements to XHTML, formatting all typeset expressions as MathML.
  • Export always creates a complete XHTML+MathML document.
  • The output consists of one or more XHTML+MathML files and two directories, HTMLFiles and HTMLLinks.
  • Mathematica always converts typeset expressions to MathML when exporting to XHTML+MathML.
  • Mathematica can export Tooltip and Hyperlink expressions, creating HTML image maps if necessary.
  • Import["file.xhtml", elem] imports the specified element from an XHTML+MathML file.
  • Import["file.xhtml", {elem, suba, subb, ...}] imports a subelement.
  • Import["file.xhtml", {{elem1, elem2, ...}}] imports multiple elements.
  • The import format can be specified with Import["file", "XHTMLMathML"] or Import["file", {"XHTMLMathML", elem, ...}].
  • Export["file.xhtml", expr, {"XHTMLMathML", elem}] creates an XHTML+MathML file by treating expr as specifying element elem.
  • Export["file.xhtml", {expr1, expr2, ...}, {{"XHTMLMathML", elem1, elem2, ...}}] treats each expri as specifying the corresponding elemi.
  • Export["file.xhtml", expr, "XHTMLMathML", opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
  • Export["file.xhtml", {elem1->expr1, elem2->expr2, ...}, {"XHTMLMathML", "Rules"}] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • Save Selection As exports the selected part of a notebook to XHTML+MathML.
  • Save As exports an entire notebook to XHTML+MathML.
"Elements"list of elements and options available in this file
"Rules"full list of rules for each element and option
"Options"list of rules for options, properties, and settings
"Data"textual and numerical content from HTML table and list elements
"FullData"full tabular content, including empty HTML table and list elements
"Hyperlinks"list of strings, representing target URLs of hyperlinks
"Plaintext"XHTML+MathML document formatted as text
"Source"raw XHTML+MathML source as a single string
"XMLObject"symbolic XML representation of the entire document
  • Import by default uses the "Plaintext" element.
"Notebook"a Notebook expression
"NotebookObject"a NotebookObject expression
"Expression"an arbitrary Mathematica expression
"ConvertLinkedNotebooks"Falsewhether to convert linked notebooks to HTML
"Content"Falsewhether to export MathML content elements
  • See the "HTML" format page for complete information about supported Import and Export options.