libSBML C++ API  5.18.0
MathML.cpp File Reference

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

Include dependency graph for MathML.cpp:

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...
 
void setSBMLDefinitionURLs (XMLInputStream &stream)
 
std::string writeMathMLToStdString (const ASTNode *node)
 
std::string writeMathMLToStdString (const ASTNode *node, SBMLNamespaces *sbmlns)
 
char * writeMathMLToString (const ASTNode *node)
 
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

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.
Examples:
createExampleSBML.cpp, translateL3Math.cpp, and translateMath.cpp.
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.
void setSBMLDefinitionURLs ( XMLInputStream stream)
std::string writeMathMLToStdString ( const ASTNode node)
std::string writeMathMLToStdString ( const ASTNode node,
SBMLNamespaces sbmlns 
)
char* writeMathMLToString ( const ASTNode node)
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.