adams.data.io.input
Class ExcelStreamingSpreadSheetReader.SheetHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by adams.data.io.input.ExcelStreamingSpreadSheetReader.SheetHandler
All Implemented Interfaces:
Stoppable, ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Enclosing class:
ExcelStreamingSpreadSheetReader

public static class ExcelStreamingSpreadSheetReader.SheetHandler
extends org.xml.sax.helpers.DefaultHandler
implements Stoppable

For reading a sheet from XML.

Version:
$Revision: 7064 $
Author:
Apache Foundation (POI), fracpete (fracpete at waikato dot ac dot nz)

Field Summary
protected  HashMap<String,Cell.ContentType> m_CellStrings
          the cell-strings.
protected  HashMap<String,Cell.ContentType> m_CellTypes
          the cell-types.
protected  Cell.ContentType m_ContentType
          what type the current cell is.
protected  StringBuilder m_LastContents
          the assembled cell content.
protected  ExcelStreamingSpreadSheetReader m_Owner
          the reader this handler belongs to.
protected  String m_Reference
          the cell reference.
protected  SpreadSheet m_Sheet
          the spreadsheet to add the content to.
protected  org.apache.poi.xssf.model.SharedStringsTable m_SST
          the table for shared strings.
protected  boolean m_Stopped
          whether the parsing was stopped.
protected  HashSet<String> m_UnknownCellStrings
          the unknown cell-strings.
protected  HashSet<String> m_UnknownCellTypes
          the unknown cell-types.
 
Constructor Summary
ExcelStreamingSpreadSheetReader.SheetHandler(ExcelStreamingSpreadSheetReader owner, SpreadSheet sheet, org.apache.poi.xssf.model.SharedStringsTable sst)
          Initializes the SAX handler.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receive notification of character data inside an element.
 void endElement(String uri, String localName, String name)
          Receive notification of the end of an element.
 HashSet<String> getUnknownCellStrings()
          Returns the unknown cell strings that were encountered.
 HashSet<String> getUnknownCellTypes()
          Returns the unknown cell types that were encountered.
 void startElement(String uri, String localName, String name, Attributes attributes)
          Receive notification of the start of an element.
 void stopExecution()
          Stops the parsing.
 
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
 

Field Detail

m_Owner

protected ExcelStreamingSpreadSheetReader m_Owner
the reader this handler belongs to.


m_Sheet

protected SpreadSheet m_Sheet
the spreadsheet to add the content to.


m_SST

protected org.apache.poi.xssf.model.SharedStringsTable m_SST
the table for shared strings.


m_LastContents

protected StringBuilder m_LastContents
the assembled cell content.


m_ContentType

protected Cell.ContentType m_ContentType
what type the current cell is.


m_Reference

protected String m_Reference
the cell reference.


m_Stopped

protected boolean m_Stopped
whether the parsing was stopped.


m_CellTypes

protected HashMap<String,Cell.ContentType> m_CellTypes
the cell-types.


m_CellStrings

protected HashMap<String,Cell.ContentType> m_CellStrings
the cell-strings.


m_UnknownCellTypes

protected HashSet<String> m_UnknownCellTypes
the unknown cell-types.


m_UnknownCellStrings

protected HashSet<String> m_UnknownCellStrings
the unknown cell-strings.

Constructor Detail

ExcelStreamingSpreadSheetReader.SheetHandler

public ExcelStreamingSpreadSheetReader.SheetHandler(ExcelStreamingSpreadSheetReader owner,
                                                    SpreadSheet sheet,
                                                    org.apache.poi.xssf.model.SharedStringsTable sst)
Initializes the SAX handler.

Parameters:
owner - the reader this handler belongs to
sheet - the spreadsheet to add the content to
sst - the table for shared strings
Method Detail

startElement

public void startElement(String uri,
                         String localName,
                         String name,
                         Attributes attributes)
                  throws SAXException
Receive notification of the start of an element.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
attributes - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.

endElement

public void endElement(String uri,
                       String localName,
                       String name)
                throws SAXException
Receive notification of the end of an element.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Receive notification of character data inside an element.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).

Specified by:
characters in interface ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - The characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.

stopExecution

public void stopExecution()
Stops the parsing.

Specified by:
stopExecution in interface Stoppable

getUnknownCellTypes

public HashSet<String> getUnknownCellTypes()
Returns the unknown cell types that were encountered.

Returns:
the cell types

getUnknownCellStrings

public HashSet<String> getUnknownCellStrings()
Returns the unknown cell strings that were encountered.

Returns:
the cell strings


Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.