MathML.cpp File Reference

Detailed Description

Utilities for reading and writing MathML to/from text strings.

Author:
Ben Bornstein
Include dependency graph for MathML.cpp:

Functions

ASTNode_t * readMathMLFromString (const char *xml)
 Reads MathML from a text string containing XML and returns the corresponding AST representation of the mathematical formula.
char * writeMathMLToString (const ASTNode *node)
 Writes the given ASTNode (and its children) as MathML to a string, and returns the string.

Function Documentation

ASTNode_t* readMathMLFromString ( const char *  xml)

Reads MathML from a text string containing XML and returns the corresponding AST representation of the mathematical formula.

Reads the MathML from the given XML string, constructs a corresponding abstract syntax tree, and returns a pointer to the root of the tree.

The content given as the string xml should be a complete, self-contained MathML formula, enclosed by <math xmlns="http://www.w3.org/1998/Math/MathML"> and </math> tags.

Parameters:
xmlthe MathML to be converted, stored in a character string.
Returns:
an ASTnode (the root of the AST representing the mathematical formula in the given XML string), otherwise NULL is returned if the given string is NULL or invalid.
char* writeMathMLToString ( const ASTNode *  node)

Writes the given ASTNode (and its children) as MathML to a string, and returns the string.

Parameters:
nodethe AST to be converted to MathML
Returns:
the XML representation of the given mathematical expression. The string is owned by the caller and should be freed (with free()) when it is no longer needed.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines