edu.msu.cme.rdp.classifier.rrnaclassifier
Class TreeFileParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
edu.msu.cme.rdp.classifier.rrnaclassifier.TreeFileParser
- All Implemented Interfaces:
- org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
class TreeFileParser
- extends org.xml.sax.helpers.DefaultHandler
A parser to parse a reader containing taxonomic training information.
Note: The first TreeNode is the root TreeNode.
Constructor Summary |
TreeFileParser()
Creates a new instance of TreeFileParser. |
Method Summary |
(package private) HierarchyTree |
createTree(java.io.Reader in,
HierarchyVersion version)
Reads from a reader that contains the information for each treenode. |
void |
endElement(java.lang.String str,
java.lang.String str1,
java.lang.String str2)
|
void |
error(org.xml.sax.SAXParseException e)
|
private void |
load(java.lang.String document)
|
void |
startElement(java.lang.String namespaceURI,
java.lang.String lName,
java.lang.String qName,
org.xml.sax.Attributes attrs)
|
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
characters, endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
treeNodeStack
private java.util.Stack treeNodeStack
root
private HierarchyTree root
TreeFileParser
TreeFileParser()
- Creates a new instance of TreeFileParser.
createTree
HierarchyTree createTree(java.io.Reader in,
HierarchyVersion version)
throws java.io.IOException,
TrainingDataException
- Reads from a reader that contains the information for each treenode.
Creates all the HierarchyTrees and returns the root of the trees.
Note: The first TreeNode is the root TreeNode.
The version information should be obtained from the other files first.
- Throws:
java.io.IOException
TrainingDataException
load
private void load(java.lang.String document)
throws TrainingDataException,
java.io.IOException
- Throws:
TrainingDataException
java.io.IOException
startElement
public void startElement(java.lang.String namespaceURI,
java.lang.String lName,
java.lang.String qName,
org.xml.sax.Attributes attrs)
throws org.xml.sax.SAXException
- Specified by:
startElement
in interface org.xml.sax.ContentHandler
- Overrides:
startElement
in class org.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
endElement
public void endElement(java.lang.String str,
java.lang.String str1,
java.lang.String str2)
throws org.xml.sax.SAXException
- Specified by:
endElement
in interface org.xml.sax.ContentHandler
- Overrides:
endElement
in class org.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
error
public void error(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- Specified by:
error
in interface org.xml.sax.ErrorHandler
- Overrides:
error
in class org.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException