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.voidendElement(String str, String str1, String str2) voidvoidstartElement(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, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
IOExceptionTrainingDataException
-
startElement
public void startElement(String namespaceURI, String lName, String qName, Attributes attrs) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
error
- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXException
-