Package net.sourceforge.jeuclid
Class MathMLParserSupport
- java.lang.Object
-
- net.sourceforge.jeuclid.MathMLParserSupport
-
@ThreadSafe public final class MathMLParserSupport extends java.lang.ObjectUtility 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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.xml.parsers.DocumentBuildercreateDocumentBuilder()Creates a DocumentBuilder that can be used to parse MathML documents into a standard DOM model.static org.w3c.dom.DocumentparseFile(java.io.File inFile)Parse an input file and return the DOM tree.static org.w3c.dom.DocumentparseInputStreamODF(java.io.InputStream inStream)Parse an input stream in ODF format.static org.w3c.dom.DocumentparseInputStreamXML(java.io.InputStream inStream)Parse an input stream in MathML XML format.static org.w3c.dom.DocumentparseString(java.lang.String content)Create a DOM Document from a given string containing MathML content.
-
-
-
Method Detail
-
createDocumentBuilder
public static javax.xml.parsers.DocumentBuilder createDocumentBuilder() throws javax.xml.parsers.ParserConfigurationExceptionCreates 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:
javax.xml.parsers.ParserConfigurationException- if the builder could not be configured properly.
-
parseInputStreamXML
public static org.w3c.dom.Document parseInputStreamXML(java.io.InputStream inStream) throws org.xml.sax.SAXException, java.io.IOExceptionParse an input stream in MathML XML format.- Parameters:
inStream- the stream to parse.- Returns:
- the DOM Tree
- Throws:
org.xml.sax.SAXException- if a parse error occurs.java.io.IOException- if a read I/O error occurs.
-
parseInputStreamODF
public static org.w3c.dom.Document parseInputStreamODF(java.io.InputStream inStream) throws org.xml.sax.SAXException, java.io.IOExceptionParse an input stream in ODF format.- Parameters:
inStream- the stream to parse.- Returns:
- the DOM Tree
- Throws:
org.xml.sax.SAXException- if a parse error occurs.java.io.IOException- if a read I/O error occurs.
-
parseFile
public static org.w3c.dom.Document parseFile(java.io.File inFile) throws org.xml.sax.SAXException, java.io.IOExceptionParse 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:
org.xml.sax.SAXException- if a parse error occurs.java.io.IOException- if a read I/O error occurs.
-
parseString
public static org.w3c.dom.Document parseString(java.lang.String content) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOExceptionCreate 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:
org.xml.sax.SAXException- a parsing error occurred.javax.xml.parsers.ParserConfigurationException- a configuration error occurred.java.io.IOException- for any other IO exception.
-
-