org.jscience.biology.taxonomy
Class ItisXmlHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.jscience.biology.taxonomy.ItisXmlHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class ItisXmlHandler
extends org.xml.sax.helpers.DefaultHandler

XML parsing routines that handle conversion of XML documents that are retrieved from ITIS into Java objects. See: "http://sis.agr.gc.ca/itis" for details.


Constructor Summary
ItisXmlHandler()
          construct an instance of the Taxon class, manually setting the attributes instead of getting them from an XML stream
 
Method Summary
 void characters(char[] ch, int start, int length)
          callback method used by the SAX Parser when the text sequences of an xml stream are detected.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          callback method used by the SAX Parser when the end tag of an element is detected.
 java.util.Vector parseTaxa(java.io.Reader xmlReader)
          construct an instance of the Taxon class from an XML Stream (generally retrieved from ITIS Canada)
 java.util.Vector parseTaxa(java.lang.String xmlString)
          construct an instance of the Taxon class from an XML String (generally retrieved from ITIS Canada)
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          callback method used by the SAX Parser when the start tag of an element is detected.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, 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

ItisXmlHandler

public ItisXmlHandler()
construct an instance of the Taxon class, manually setting the attributes instead of getting them from an XML stream

Method Detail

parseTaxa

public java.util.Vector parseTaxa(java.io.Reader xmlReader)
                           throws java.lang.Exception
construct an instance of the Taxon class from an XML Stream (generally retrieved from ITIS Canada)

Parameters:
xmlReader - the XML representation of the taxon as a Reader
Returns:
DOCUMENT ME!
Throws:
java.lang.Exception - DOCUMENT ME!

parseTaxa

public java.util.Vector parseTaxa(java.lang.String xmlString)
                           throws java.lang.Exception
construct an instance of the Taxon class from an XML String (generally retrieved from ITIS Canada)

Parameters:
xmlString - the XML representation of the taxon as a String
Returns:
DOCUMENT ME!
Throws:
java.lang.Exception - DOCUMENT ME!

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
callback method used by the SAX Parser when the start tag of an element is detected. Used in this context to parse and store the taxon information in class variables.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - DOCUMENT ME!
localName - DOCUMENT ME!
qName - DOCUMENT ME!
atts - DOCUMENT ME!
Throws:
org.xml.sax.SAXException - DOCUMENT ME!

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
callback method used by the SAX Parser when the end tag of an element is detected. Used in this context to parse and store the taxon information in class variables.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - DOCUMENT ME!
localName - DOCUMENT ME!
qName - DOCUMENT ME!
Throws:
org.xml.sax.SAXException - DOCUMENT ME!

characters

public void characters(char[] ch,
                       int start,
                       int length)
callback method used by the SAX Parser when the text sequences of an xml stream are detected. Used in this context to parse and store the taxon information in class variables.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - DOCUMENT ME!
start - DOCUMENT ME!
length - DOCUMENT ME!