Package net.sourceforge.jeuclid.parser
Class Parser
- java.lang.Object
-
- net.sourceforge.jeuclid.parser.Parser
-
@ThreadSafe public final class Parser extends java.lang.ObjectA JAXP compatible approach to MathML Parsing.- Version:
- $Revision: 5a7becda9147 $
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedParser()Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description javax.xml.parsers.DocumentBuildergetDocumentBuilder()Retrieve a DocumentBuilder suitable for MathML parsing.static ParsergetInstance()Retrieve the singleton Parser instance.static ParsergetParser()Deprecated.usegetInstance()instead.org.w3c.dom.Nodeparse(javax.xml.transform.Source source)Extract the top Node from a given Source.org.w3c.dom.DocumentparseStreamSource(javax.xml.transform.stream.StreamSource streamSource)Parse a StreamSource and return its Document.org.w3c.dom.DocumentparseStreamSourceAsOdf(javax.xml.transform.stream.StreamSource streamSource)Parse a given StreamSource which represents an ODF document.org.w3c.dom.DocumentparseStreamSourceAsXml(javax.xml.transform.stream.StreamSource streamSource)Parse a given StreamSource which represents an XML document.
-
-
-
Method Detail
-
getInstance
public static Parser getInstance()
Retrieve the singleton Parser instance.- Returns:
- a Parser object.
-
getParser
@Deprecated public static Parser getParser() throws javax.xml.parsers.ParserConfigurationException
Deprecated.usegetInstance()instead.usegetInstance()instead.- Returns:
- see
getInstance() - Throws:
javax.xml.parsers.ParserConfigurationException- seegetInstance()
-
parseStreamSource
public org.w3c.dom.Document parseStreamSource(javax.xml.transform.stream.StreamSource streamSource) throws org.xml.sax.SAXException, java.io.IOExceptionParse a StreamSource and return its Document.This method will auto-detect ODF or XML format and load an appropriate parser.
- Parameters:
streamSource- A StreamSource.- Returns:
- A DOM Document representation for this source.
- Throws:
org.xml.sax.SAXException- if a parse error occurred.java.io.IOException- if an I/O error occurred.
-
parseStreamSourceAsOdf
public org.w3c.dom.Document parseStreamSourceAsOdf(javax.xml.transform.stream.StreamSource streamSource) throws java.io.IOException, org.xml.sax.SAXExceptionParse a given StreamSource which represents an ODF document.- Parameters:
streamSource- StreamSource to parse.- Returns:
- the Document contained within.
- Throws:
org.xml.sax.SAXException- if a parse error occurred.java.io.IOException- if an I/O error occurred.
-
parseStreamSourceAsXml
public org.w3c.dom.Document parseStreamSourceAsXml(javax.xml.transform.stream.StreamSource streamSource) throws org.xml.sax.SAXException, java.io.IOExceptionParse a given StreamSource which represents an XML document.- Parameters:
streamSource- StreamSource to parse.- Returns:
- the Document contained within.
- Throws:
org.xml.sax.SAXException- if a parse error occurred.java.io.IOException- if an I/O error occurred.
-
getDocumentBuilder
public javax.xml.parsers.DocumentBuilder getDocumentBuilder()
Retrieve a DocumentBuilder suitable for MathML parsing.Please note:
- There is one instance of the builder per thread.
- The builder instance is not thread safe, so it may not be passed among threads.
- Multiple Threads may call getDocumentBuilder concurrently
- Returns:
- a DocumentBuilder
-
parse
public org.w3c.dom.Node parse(javax.xml.transform.Source source) throws org.xml.sax.SAXException, java.io.IOExceptionExtract the top Node from a given Source.- Parameters:
source- the Source to use. Currently supported areDOMSource,StreamSource- Returns:
- the top NODE.
- Throws:
org.xml.sax.SAXException- if a parse error occurred.java.io.IOException- if an I/O error occurred.
-
-