Package adams.data.io.input
Class ExcelStreamingSpreadSheetReader.SheetHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- adams.data.io.input.ExcelStreamingSpreadSheetReader.SheetHandler
-
- All Implemented Interfaces:
Stoppable
,ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
- Enclosing class:
- ExcelStreamingSpreadSheetReader
public static class ExcelStreamingSpreadSheetReader.SheetHandler extends DefaultHandler implements Stoppable
For reading a sheet from XML.- Version:
- $Revision$
- Author:
- Apache Foundation (POI), fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description 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 int
m_FirstRow
the first row.protected StringBuilder
m_LastContents
the assembled cell content.protected int
m_LastRow
the last row.protected boolean
m_LoggingAtLeastFine
whether logging is at least fine.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 gnu.trove.set.hash.TIntHashSet
m_TextColumns
the text columns.protected String
m_UnknownCellString
the current unknown cell-string.protected HashSet<String>
m_UnknownCellStrings
the unknown cell-strings.protected HashMap<String,String>
m_UnknownCellStringsExamples
examples of the unknown cell-strings (string - example).protected String
m_UnknownCellType
the current unknown cell-types.protected HashSet<String>
m_UnknownCellTypes
the unknown cell-type.protected HashMap<String,String>
m_UnknownCellTypesExamples
examples of the unknown cell-types (type - example).
-
Constructor Summary
Constructors Constructor Description SheetHandler(ExcelStreamingSpreadSheetReader owner, SpreadSheet sheet, org.apache.poi.xssf.model.SharedStringsTable sst)
Initializes the SAX handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.HashMap<String,String>
getUnknownCellStringsExamples()
Returns examples of the unknown cell strings that were encountered.HashSet<String>
getUnknownCellTypes()
Returns the unknown cell types that were encountered.HashMap<String,String>
getUnknownCellTypesExamples()
Returns examples of the unknown cell types that were encountered.protected boolean
isInRange(int row)
Checks whether the 0-based row is in the window that we want to read in.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
-
-
-
-
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_UnknownCellType
protected String m_UnknownCellType
the current unknown cell-types.
-
m_UnknownCellTypesExamples
protected HashMap<String,String> m_UnknownCellTypesExamples
examples of the unknown cell-types (type - example).
-
m_UnknownCellString
protected String m_UnknownCellString
the current unknown cell-string.
-
m_UnknownCellStringsExamples
protected HashMap<String,String> m_UnknownCellStringsExamples
examples of the unknown cell-strings (string - example).
-
m_LoggingAtLeastFine
protected boolean m_LoggingAtLeastFine
whether logging is at least fine.
-
m_TextColumns
protected gnu.trove.set.hash.TIntHashSet m_TextColumns
the text columns.
-
m_FirstRow
protected int m_FirstRow
the first row.
-
m_LastRow
protected int m_LastRow
the last row.
-
-
Constructor Detail
-
SheetHandler
public SheetHandler(ExcelStreamingSpreadSheetReader owner, SpreadSheet sheet, org.apache.poi.xssf.model.SharedStringsTable sst)
Initializes the SAX handler.- Parameters:
owner
- the reader this handler belongs tosheet
- the spreadsheet to add the content tosst
- 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 interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- 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.name
- 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.
-
isInRange
protected boolean isInRange(int row)
Checks whether the 0-based row is in the window that we want to read in.- Parameters:
row
- the row to check- Returns:
- true if inside the window
-
endElement
public void endElement(String uri, String localName, String name) throws SAXException
Receive notification of the end of an element.- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- 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.name
- 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 interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- 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 interfaceStoppable
-
getUnknownCellTypes
public HashSet<String> getUnknownCellTypes()
Returns the unknown cell types that were encountered.- Returns:
- the cell types
-
getUnknownCellTypesExamples
public HashMap<String,String> getUnknownCellTypesExamples()
Returns examples of the unknown cell types that were encountered.- Returns:
- the examples
-
getUnknownCellStrings
public HashSet<String> getUnknownCellStrings()
Returns the unknown cell strings that were encountered.- Returns:
- the cell strings
-
-