Package edu.msu.cme.rdp.classifier.io
Class TreeFileParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
edu.msu.cme.rdp.classifier.io.TreeFileParser
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
A parser to parse a reader containing taxonomic training information.
Note: The first TreeNode is the root TreeNode.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateTree
(Reader in, HierarchyVersion version) Reads from a reader that contains the information for each treenode.void
endElement
(String str, String str1, String str2) void
void
startElement
(String namespaceURI, String lName, String qName, 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
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
TreeFileParser
public TreeFileParser()Creates a new instance of TreeFileParser.
-
-
Method Details
-
getTrainRank
-
createTree
public HierarchyTree createTree(Reader in, HierarchyVersion version) throws 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:
IOException
TrainingDataException
-
startElement
public void startElement(String namespaceURI, String lName, String qName, Attributes attrs) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
error
- Specified by:
error
in interfaceErrorHandler
- Overrides:
error
in classDefaultHandler
- Throws:
SAXException
-