-
MathType
-
WirisQuizzes
-
Nubric
-
CalcMe
-
MathPlayer
-
Store FAQ
-
MathFlow
-
BF FAQ
-
Miscellaneous
-
Wiris Integrations
Content MathML
Reading time: 2minThis article describes how MathType works with Content MathML, including supported formats, syntax validation, and available methods for converting between Presentation MathML and Content MathML. It is intended for developers and administrators integrating MathType into web applications or server environments.
Requirements/Prerequisites:
- MathType Web integration.
- Access to MathType services (cloud or on-premises).
- MathType server components and a valid license (for Java API methods).
Concepts:
Presentation MathML describes how mathematical expressions are displayed (how an equation looks visually).
Content MathML describes the semantic meaning of mathematical expressions (what the formula is, rather than how it appears).
MathType works natively with Presentation MathML but can also import and process Content MathML. Formulas can be converted between both formats provided they are valid according to MathType's built-in content grammar.
For example, the following expressions are valid:

The following expressions are not valid:

For more information about formula evaluation, see Expression evaluation.
Reference details
Content MathML support:
| Feature | Supported | Description |
|---|---|---|
| Content MathML input | Yes | The MathType editor accepts Content MathML as input. |
| Content MathML export | Indirectly | Requires conversion from Presentation MathML using a call to an API. |
| Presentation MathML input | Yes | Native MathType format. |
| Syntax checking | Optional | Helps identify formulas that cannot be converted to Content MathML. |
Syntax checking
Syntax checking highlights formulas that are not well-formed and therefore cannot be converted to Content MathML.
Example:

In this example, 3+ is not considered a valid expression.
To enable syntax checking during editor initialization:
editor = com.wiris.jsEditor.JsEditor.newInstance({
'checkSyntax': 'true'
});
To enable syntax checking after the editor has been created:
editor.setParams({
'checkSyntax': 'true'
});
Importing Content MathML
The MathType editor accepts both Presentation MathML and Content MathML directly. Rendering services also support Content MathML when generating output formats such as PNG images.
Exporting Content MathML
The MathType editor interface only generates Presentation MathML directly. To obtain Content MathML, you must convert the generated Presentation MathML using either a web service or a server-side API.
| Conversion method | Availability | Notes |
|---|---|---|
| Web service | Cloud | Supports GET and POST requests, but POST is recommended. |
| Java API | On-premises | Requires MathType server components. |
Example usage
Convert Presentation MathML to Content MathML using the web service:
https://www.wiris.net/demo/editor/mathml2content?mml=<math><mn>1</mn><mo>-</mo><mn>2</mn></math>
Response:
<math>
<apply>
<minus/>
<cn>1</cn>
<cn>2</cn>
</apply>
</math>
Convert Presentation MathML using the Java API:
To use this method, you will need a license to download and run the MathType server components.
PublicServicesInterface ps = PublicServices.getInstance();
Properties p = new Properties();
String content = ps.mathml2content(
"<math><mn>1</mn><mo>+</mo><mn>2</mn></math>",
p
);
For Java integrations, add WIRISeditor.jar to the application classpath.
Converting Content MathML to Presentation MathML
Since the MathType editor accepts Content MathML directly, conversion is rarely required. If needed, use the content2mathml method.
Example:
https://www.wiris.net/demo/editor/content2mathml?mml=<math><apply><minus/><cn>1</cn><cn>2</cn></apply></math>
Response:
<math>
<mn>1</mn>
<mo>-</mo>
<mn>2</mn>
</math>
Error handling:
Conversion may fail if the provided MathML is malformed or does not comply with MathType's Content MathML grammar. Enable syntax checking whenever possible to help identify invalid expressions before conversion.
Related resources: