public abstract class NdfHandler extends java.lang.Object implements SimpleLogSupport, NdfParseControl, NdfConstants
NdfHandler is notified by the NdfParser about all structures and
properties found during parsing. All callback methods are implemented but do nothing.
Subclasses may override the according methods in order to interpret or collect the data
as needed.allowedInNames, blockCommentChar, booleanFalseChar, booleanFalseLiteral, booleanTrueChar, booleanTrueLiteral, currentNdfDocVersion, defaultTextEndChar, defaultTextParagraphChar, lineCommentChar, ndfDocAuthorKey, ndfDocCreatedKey, ndfDocEncodingKey, ndfDocTypeKey, ndfDocVersionKey, nullLiteral, quotingBreakCodes, standardBreakCodes, structureChar, textValueBreakCodes, validTextBreakSymbols| Constructor and Description |
|---|
NdfHandler() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptDocumentVersion(java.lang.String documentVersion)
Allows for breaking parsing if document-version and
parser-version do not match.
|
protected void |
checkDocumentType(java.lang.String expectedDocType)
Checks whether the document has got the expected document type (ndfDocType property).
|
void |
doneArray(NdfStructure struct)
Called when an array structure is done.
|
void |
doneDocument(NdfStructure struct)
Called when document parsing has finished.
|
void |
doneList(NdfStructure struct)
Called when a list structure is done.
|
void |
doneObject(NdfStructure struct)
Called when an object structure is done.
|
void |
doneTable(NdfStructure struct)
Called when a table structure is done.
|
void |
doneText(NdfStructure struct)
Called when a TEXT structure is done.
|
void |
foundArrayValue(NdfStructure struct,
int dimension,
int index,
AsciiWord data)
Called when an array value was found within an array structure.
|
void |
foundArrayValue(NdfStructure struct,
int dimension,
int index,
java.lang.String value)
Called when an array value was found within an array structure.
|
void |
foundListValue(NdfStructure struct,
AsciiWord data)
Called when a list value was found within a list structure.
|
void |
foundListValue(NdfStructure struct,
java.lang.String value)
Called when a list value was found within a list structure.
|
void |
foundProperties(NdfStructure struct,
NdfProperties props)
Called when properties are found on top level.
|
void |
foundTableCell(NdfStructure struct,
int rowIndex,
int columnIndex,
AsciiWord data)
Called when a table cell value was found within a table structure.
|
void |
foundTableRow(NdfStructure struct,
int rowIndex,
NdfProperties props)
Called when a table row was found within a table structure.
|
void |
foundTableRow(NdfStructure struct,
int rowIndex,
java.lang.String[] data)
Called when a table row was found within a table structure.
|
void |
foundText(NdfStructure struct,
int paragraphIndex,
java.util.List<java.lang.String> lines)
Notifies about text-lines found within a TEXT structure.
|
void |
foundText(NdfStructure struct,
java.lang.String text)
Notifies about the text found within a TEXT structure.
|
int |
getCurrentNestingLevel()
Returns the current nesting level.
|
NdfStructure |
getCurrentStructure()
Returns the
NdfStructure which is currently being parsed. |
java.lang.String |
getDocAuthor() |
java.sql.Timestamp |
getDocCreated() |
java.lang.String |
getDocEncoding() |
java.lang.String |
getDocType() |
java.lang.String |
getDocVersion() |
FileInfo |
getFileInfo() |
int |
getLineNumber() |
LogChannel |
getLogChannel() |
int |
getMaxNestingLevel()
Returns the maximum nesting level reached during parsing.
|
boolean |
isLogDebug() |
boolean |
isLogVerbose() |
void |
logDebug(java.lang.String message) |
void |
logDump(java.lang.String message) |
void |
logError(java.lang.String message) |
void |
logError(java.lang.String message,
java.lang.Exception e) |
void |
logFatal(java.lang.String message,
java.lang.Exception e) |
void |
logInfo(java.lang.String message) |
void |
logVerbose(java.lang.String message) |
void |
logWarning(java.lang.String message) |
void |
setLogChannel(LogChannel logCh) |
NotifyArrayValue |
startArray(NdfStructure struct,
NdfProperties props,
int[] dimensions)
Called when an array structure was found.
|
void |
startDocument(NdfStructure struct,
NdfProperties headerProps)
Called when document parsing is started.
|
NotifyListValue |
startList(NdfStructure struct,
NdfProperties props)
Called when a list structure was found.
|
void |
startObject(NdfStructure struct,
NdfProperties props)
Called when an object structure was detected.
|
NotifyTableValue |
startTable(NdfStructure struct,
NdfProperties props,
java.lang.String[] columns)
Called when a table structure was found.
|
NotifyText |
startText(NdfStructure struct,
NdfProperties props)
Called when a TEXT structure was found.
|
public java.lang.String getDocVersion()
public java.lang.String getDocEncoding()
public java.lang.String getDocAuthor()
public java.lang.String getDocType()
public java.sql.Timestamp getDocCreated()
throws java.text.ParseException
java.text.ParseExceptionpublic void startDocument(NdfStructure struct, NdfProperties headerProps) throws java.lang.Exception
headerProps - the header properties found in the documentjava.lang.Exceptionpublic void doneDocument(NdfStructure struct) throws java.lang.Exception
java.lang.Exceptionpublic void foundProperties(NdfStructure struct, NdfProperties props) throws java.lang.Exception
java.lang.Exceptionpublic void startObject(NdfStructure struct, NdfProperties props) throws java.lang.Exception
java.lang.Exceptionpublic void doneObject(NdfStructure struct) throws java.lang.Exception
java.lang.Exceptionpublic NotifyText startText(NdfStructure struct, NdfProperties props) throws java.lang.Exception
java.lang.Exceptionpublic void foundText(NdfStructure struct, int paragraphIndex, java.util.List<java.lang.String> lines) throws java.lang.Exception
java.lang.Exceptionpublic void foundText(NdfStructure struct, java.lang.String text) throws java.lang.Exception
java.lang.Exceptionpublic void doneText(NdfStructure struct) throws java.lang.Exception
java.lang.Exceptionpublic NotifyTableValue startTable(NdfStructure struct, NdfProperties props, java.lang.String[] columns) throws java.lang.Exception
NotifyTableValue.AS_PROPERTIESfoundTableRow(NdfStructure, int, NdfProperties)NotifyTableValue.AS_STRING_ARRAYfoundTableRow(NdfStructure, int, String[])
NotifyTableValue.AS_BUFFERED_WORDfoundTableCell(NdfStructure, int, int, AsciiWord)java.lang.Exceptionpublic void foundTableRow(NdfStructure struct, int rowIndex, java.lang.String[] data) throws java.lang.Exception
NotifyTableValue.AS_STRING_ARRAY notification mode.
It is quite expensive because it parses values the same way as property values.java.lang.Exceptionpublic void foundTableRow(NdfStructure struct, int rowIndex, NdfProperties props) throws java.lang.Exception
NotifyTableValue.AS_PROPERTIES notification mode.
It is quite expensive because it parses values the same way as property values.
But it provides the convenience to extract values readily converted to the desired data type.java.lang.Exceptionpublic void foundTableCell(NdfStructure struct, int rowIndex, int columnIndex, AsciiWord data) throws java.lang.Exception
NotifyTableValue.AS_BUFFERED_WORD notification mode.
It is very fast but does no interpretation on the read words at all.
It does also NOT support quoting of values and thus can only be used for numeric values.
For fast data conversion use data.asDouble(), data.asInt() etc.
Note that this method is called for each cell value in a table row.java.lang.Exceptionpublic void doneTable(NdfStructure struct) throws java.lang.Exception
java.lang.Exceptionpublic NotifyListValue startList(NdfStructure struct, NdfProperties props) throws java.lang.Exception
NotifyListValue.AS_STRINGfoundListValue(NdfStructure, String)
NotifyListValue.AS_BUFFERED_WORDfoundListValue(NdfStructure, AsciiWord)java.lang.Exceptionpublic void foundListValue(NdfStructure struct, java.lang.String value) throws java.lang.Exception
NotifyListValue.AS_STRING notification mode.
It is quite expensive because it parses values the same way as property values.java.lang.Exceptionpublic void foundListValue(NdfStructure struct, AsciiWord data) throws java.lang.Exception
NotifyListValue.AS_BUFFERED_WORD notification mode.
It is very fast but does no interpretation on the read words at all.
For fast data conversion use data.asDouble(), data.asInt() etc.java.lang.Exceptionpublic void doneList(NdfStructure struct) throws java.lang.Exception
java.lang.Exceptionpublic NotifyArrayValue startArray(NdfStructure struct, NdfProperties props, int[] dimensions) throws java.lang.Exception
NotifyArrayValue.AS_STRINGfoundArrayValue(NdfStructure, int, int, String)
NotifyArrayValue.AS_BUFFERED_WORDfoundArrayValue(NdfStructure, int, int, AsciiWord)java.lang.Exceptionpublic void foundArrayValue(NdfStructure struct, int dimension, int index, java.lang.String value) throws java.lang.Exception
NotifyArrayValue.AS_STRING notification mode.
It is quite expensive because it parses values the same way as property values.java.lang.Exceptionpublic void foundArrayValue(NdfStructure struct, int dimension, int index, AsciiWord data) throws java.lang.Exception
NotifyArrayValue.AS_BUFFERED_WORD notification mode.
It is very fast but does no interpretation on the read words at all.
For fast data conversion use data.asDouble(), data.asInt() etc.java.lang.Exceptionpublic void doneArray(NdfStructure struct) throws java.lang.Exception
java.lang.Exceptionprotected final void checkDocumentType(java.lang.String expectedDocType)
throws java.lang.Exception
java.lang.Exceptionpublic boolean acceptDocumentVersion(java.lang.String documentVersion)
public final NdfStructure getCurrentStructure()
NdfStructure which is currently being parsed.getCurrentStructure in interface NdfParseControlpublic final int getCurrentNestingLevel()
NdfParseControlgetCurrentNestingLevel in interface NdfParseControlpublic final int getMaxNestingLevel()
getMaxNestingLevel in interface NdfParseControlpublic final FileInfo getFileInfo()
public final int getLineNumber()
public final LogChannel getLogChannel()
getLogChannel in interface SimpleLogSupportpublic final void setLogChannel(LogChannel logCh)
setLogChannel in interface SimpleLogSupportpublic final boolean isLogDebug()
isLogDebug in interface SimpleLogSupportpublic final boolean isLogVerbose()
isLogVerbose in interface SimpleLogSupportpublic final void logDebug(java.lang.String message)
logDebug in interface SimpleLogSupportpublic final void logDump(java.lang.String message)
logDump in interface SimpleLogSupportpublic final void logError(java.lang.String message,
java.lang.Exception e)
logError in interface SimpleLogSupportpublic final void logError(java.lang.String message)
logError in interface SimpleLogSupportpublic final void logFatal(java.lang.String message,
java.lang.Exception e)
logFatal in interface SimpleLogSupportpublic final void logInfo(java.lang.String message)
logInfo in interface SimpleLogSupportpublic final void logVerbose(java.lang.String message)
logVerbose in interface SimpleLogSupportpublic final void logWarning(java.lang.String message)
logWarning in interface SimpleLogSupportCopyright © 2014 EsprIT-Systems. All Rights Reserved.