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

Background & Context

    • 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 & Export

  • 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.
  • The Wolfram Language always converts typeset expressions to MathML when exporting to XHTML+MathML.
  • The Wolfram Language 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 following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Notebook Interface

  • Save Selection As exports the selected part of a notebook to XHTML+MathML.
  • Save As exports an entire notebook to XHTML+MathML.

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • Import elements:
  • "Data"textual and numerical content from HTML table and list elements
    "FullData"full tabular content, including empty HTML table and list elements
    "Hyperlinks"hyperlinks, given as a list of strings
    "Plaintext"XHTML+MathML document formatted as text
    "Images"images embedded in the XHTML document
    "Source"raw XHTML+MathML source as a single string
    "Title"XHTML page title
    "ImageLinks"URLs of embedded images
    "XMLObject"symbolic XML representation of the entire document
  • Import by default uses the "Plaintext" element.
  • Export elements:
  • "Notebook"a Notebook expression
    "NotebookObject"a NotebookObject expression
    "Expression"an arbitrary Wolfram Language expression

Options

  • Basic Export options:
  • "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.

Examples

Basic Examples  (2)

Read an XHTML file as plain text:

Show the Import elements available in this file:

Import the tabular content from this file:

This exports a mathematical expression to HTML: