Package net.sourceforge.jeuclid
Class MathMLParserSupport
java.lang.Object
net.sourceforge.jeuclid.MathMLParserSupport
Utility class for the support parsing MathML and OpenDocument Formula (ODF)
files.
This class supports parsing of files that are either MathML or OpenDocument Formula (ODF) files. It also supports parsing MathML from a given text string.
- Version:
- $Revision: 96cb88e4e122 $
-
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentBuilderCreates a DocumentBuilder that can be used to parse MathML documents into a standard DOM model.static DocumentParse an input file and return the DOM tree.static DocumentparseInputStreamODF(InputStream inStream) Parse an input stream in ODF format.static DocumentparseInputStreamXML(InputStream inStream) Parse an input stream in MathML XML format.static DocumentparseString(String content) Create a DOM Document from a given string containing MathML content.
-
Method Details
-
createDocumentBuilder
Creates a DocumentBuilder that can be used to parse MathML documents into a standard DOM model.- Returns:
- a DocumentBuilder instance that is configured for MathML
- Throws:
ParserConfigurationException- if the builder could not be configured properly.
-
parseInputStreamXML
Parse an input stream in MathML XML format.- Parameters:
inStream- the stream to parse.- Returns:
- the DOM Tree
- Throws:
SAXException- if a parse error occurs.IOException- if a read I/O error occurs.
-
parseInputStreamODF
Parse an input stream in ODF format.- Parameters:
inStream- the stream to parse.- Returns:
- the DOM Tree
- Throws:
SAXException- if a parse error occurs.IOException- if a read I/O error occurs.
-
parseFile
Parse an input file and return the DOM tree.This function will auto-detect if the given input is in MathML or ODF format.
- Parameters:
inFile- the file to parse.- Returns:
- the DOM Tree
- Throws:
SAXException- if a parse error occurs.IOException- if a read I/O error occurs.
-
parseString
public static Document parseString(String content) throws SAXException, ParserConfigurationException, IOException Create a DOM Document from a given string containing MathML content. This function uses a DOM Parser configured for MathML.- Parameters:
content- A String containing MathML.- Returns:
- a DOM Document.
- Throws:
SAXException- a parsing error occurred.ParserConfigurationException- a configuration error occurred.IOException- for any other IO exception.
-