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.DefaultHandler

A parser to parse a reader containing taxonomic training information. Note: The first TreeNode is the root TreeNode.

### Constructor Summary

Constructors
Constructor and Description
`TreeFileParser()` Creates a new instance of TreeFileParser.

### Method Summary

All Methods Instance Methods Concrete Methods
`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)`
`java.lang.String` `getTrainRank()`
`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`

### Constructor Detail

#### TreeFileParser

    public TreeFileParser()

Creates a new instance of TreeFileParser.

### 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.IOException`
  `TrainingDataException`

#### 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`