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:
org.xml.sax.ContentHandler,org.xml.sax.DTDHandler,org.xml.sax.EntityResolver,org.xml.sax.ErrorHandler
public class TreeFileParser extends org.xml.sax.helpers.DefaultHandlerA parser to parse a reader containing taxonomic training information. Note: The first TreeNode is the root TreeNode.
-
-
Constructor Summary
Constructors Constructor Description TreeFileParser()Creates a new instance of TreeFileParser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HierarchyTreecreateTree(java.io.Reader in, HierarchyVersion version)Reads from a reader that contains the information for each treenode.voidendElement(java.lang.String str, java.lang.String str1, java.lang.String str2)voiderror(org.xml.sax.SAXParseException e)java.lang.StringgetTrainRank()voidstartElement(java.lang.String namespaceURI, java.lang.String lName, java.lang.String qName, org.xml.sax.Attributes attrs)
-
-
-
Method Detail
-
getTrainRank
public java.lang.String getTrainRank()
-
createTree
public 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.IOExceptionTrainingDataException
-
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:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin classorg.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:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin classorg.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:
errorin interfaceorg.xml.sax.ErrorHandler- Overrides:
errorin classorg.xml.sax.helpers.DefaultHandler- Throws:
org.xml.sax.SAXException
-
-