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

  • Import fully supports XHTML versions 1.0 and 1.1.
  • Export generates documents conforming to XHTML 1.1 and MathML 2.0.
  • Background

      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 and 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 reference pages for full general information on Import and Export.
    • ImportString and ExportString support the XHTML+MathML format.

    Notebook Interface

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

    Elements

    • General Import elements:
    • "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
    • 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:

    In[1]:=
    Click for copyable input
    Out[1]=

    Show the Import elements available in this file:

    In[2]:=
    Click for copyable input
    Out[2]=

    Import the tabular content from this file:

    In[3]:=
    Click for copyable input
    Out[3]//TableForm=

    This exports a mathematical expression to HTML:

    In[1]:=
    Click for copyable input
    Out[1]=

    See Also

    "GIF"  "HTML"  "LaTeX"  "NB"  "TeX"  "XHTML"

    Introduced in 1999
    (4.0)
    | Updated in 2007
    (6.0)