libSBML C++ API  5.20.4
MathML.h File Reference

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

Include dependency graph for MathML.h:
This graph shows which files directly or indirectly include this file:

Functions

ASTNode_treadMathMLFromString (const char *xml)
 Reads the MathML from the given XML string, constructs a corresponding abstract syntax tree, and returns a pointer to the root of the tree. More...
 
ASTNode_treadMathMLFromStringWithNamespaces (const char *xml, XMLNamespaces_t *xmlns)
 Reads the MathML from the given XML string, constructs a corresponding abstract syntax tree, and returns a pointer to the root of the tree. More...
 
char * writeMathMLToString (const ASTNode_t *node)
 Writes the given AST node (and its children) to a string as MathML, and returns the string. More...
 
char * writeMathMLWithNamespaceToString (const ASTNode_t *node, SBMLNamespaces_t *sbmlns)
 Writes the given AST node (and its children) to a string as MathML, and returns the string. More...
 

Detailed Description

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

Author
Ben Bornstein

Function Documentation

◆ readMathMLFromString()

ASTNode_t* readMathMLFromString ( const char *  xml)

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

Parameters
xmla string containing a full MathML expression.
Returns
the root of an AST corresponding to the given mathematical expression, otherwise NULL is returned if the given string is NULL or invalid.

◆ readMathMLFromStringWithNamespaces()

ASTNode_t* readMathMLFromStringWithNamespaces ( const char *  xml,
XMLNamespaces_t xmlns 
)

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

Parameters
xmla string containing a full MathML expression.
xmlnsan XMLNamespaces object containing namespaces that are considered active during the read. (For example, an SBML Level 3 package namespace.)
Returns
the root of an AST corresponding to the given mathematical expression, otherwise NULL is returned if the given string is NULL or invalid.

◆ writeMathMLToString()

char* writeMathMLToString ( const ASTNode_t node)

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

Parameters
nodethe root of an AST to write out to the stream.
Returns
a string containing the written-out MathML representation of the given AST.
Note
The string is owned by the caller and should be freed (with free()) when no longer needed. NULL is returned if the given argument is NULL.

◆ writeMathMLWithNamespaceToString()

char* writeMathMLWithNamespaceToString ( const ASTNode_t node,
SBMLNamespaces_t sbmlns 
)

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

Parameters
nodethe root of an AST to write out to the stream.
sbmlnsthe SBML namespace to be used
Returns
a string containing the written-out MathML representation of the given AST.
Note
The string is owned by the caller and should be freed (with free()) when no longer needed. NULL is returned if the given argument is NULL.