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

Documentation / Mathematica / Add-ons & Links / XML Capabilities / Introduction /

Native XML Formats

Mathematica has built-in support for four XML formats: MathML, SVG, NotebookML, and ExpressionML. If you import a document in any of these formats, it is automatically converted into a specific type of Mathematica expression. A NotebookML file is imported as a notebook expression. An ExpressionML file is imported as a cell expression. A MathML file is returned as a box expression. More details about each of these formats are given below.


MathML is an XML format developed by the W3C for describing the structure and meaning of mathematical formulas. It provides a standard way of displaying mathematical notation in web pages. Version 4.1 of Mathematica included limited support for import and export of MathML. In Version 4.2 and later, the support has been greatly expanded with many new functions for generating and manipulating MathML and for converting between MathML and the expressions used internally by Mathematica to represent mathematics.

The new MathML features make Mathematica an excellent environment for authoring and editing MathML content. You can, for example, use Mathematica's powerful typesetting system to create properly formatted equations and then copy and paste them in MathML format into an HTML document for display on the web. You can also import MathML equations from other applications and evaluate them using Mathematica.


SVG (Scalable Vector Graphics) is an XML format developed by the W3C for describing two-dimensional graphics. SVG images can be rescaled without loss of resolution and are usually much smaller in size than comparable JPEG or GIF images. SVG files can also be manipulated with a scripting language to produce dynamic and interactive graphics. Using Mathematica 4.2 and later, you can directly export any graphics present in a notebook, in SVG format.


NotebookML is an XML format developed by Wolfram Research for representing Mathematica notebooks. The tags and attributes used in NotebookML are specified by a DTD and correspond closely to the structures used in notebook expressions. Using NotebookML, you can save your notebooks as well-formed XML documents and then import them back into Mathematica in a completely lossless way.

NotebookML provides a bridge between Mathematica and other XML applications, allowing you to use notebooks with standard web technologies such as Cascading Style Sheets (CSS) and Extensible Stylesheet Language Transformations (XSLT). For example, you can convert a notebook into an XML format such as XHTML by performing XSLT transformations on the NotebookML source. You can then display the resulting XHTML document on the web using CSS style sheets to control its appearance. Support for MathML and SVG is built into NotebookML, in that you can choose to save all equations in a notebook as MathML and all graphics as SVG when saving the notebook as NotebookML.


ExpressionML is a specialized subset of NotebookML. ExpressionML fragments can represent any Mathematica expression in an XML format. NotebookML uses ExpressionML fragments to represent Mathematica expressions that are embedded within a notebook structure.