adams.data.io.input
Class ExcelSAXSpreadSheetReader.SheetHandler

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

public static class ExcelSAXSpreadSheetReader.SheetHandler
extends org.xml.sax.helpers.DefaultHandler

For reading a sheet from XML.

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

Field Summary
protected  adams.data.spreadsheet.Cell.ContentType m_ContentType
          what type the current cell is.
protected  StringBuilder m_LastContents
          the assembled cell content.
protected  ExcelSAXSpreadSheetReader m_Owner
          the reader this handler belongs to.
protected  String m_Reference
          the cell reference.
protected  adams.data.spreadsheet.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  HashSet<String> m_UnhandledCellTypes
          for caching unhandled cell types.
 
Constructor Summary
ExcelSAXSpreadSheetReader.SheetHandler(ExcelSAXSpreadSheetReader owner, adams.data.spreadsheet.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.
 void startElement(String uri, String localName, String name, Attributes attributes)
          Receive notification of the start of an element.
 
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 ExcelSAXSpreadSheetReader m_Owner
the reader this handler belongs to.


m_Sheet

protected adams.data.spreadsheet.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 adams.data.spreadsheet.Cell.ContentType m_ContentType
what type the current cell is.


m_Reference

protected String m_Reference
the cell reference.


m_UnhandledCellTypes

protected HashSet<String> m_UnhandledCellTypes
for caching unhandled cell types.

Constructor Detail

ExcelSAXSpreadSheetReader.SheetHandler

public ExcelSAXSpreadSheetReader.SheetHandler(ExcelSAXSpreadSheetReader owner,
                                              adams.data.spreadsheet.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.


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