Package csv.impl
Class XmlReader
java.lang.Object
csv.impl.AbstractTableReader
csv.impl.AbstractStreamTableReader
csv.impl.XmlReader
- All Implemented Interfaces:
TableReader,Iterable<Object[]>,Iterator<Object[]>
Reads from a XML file.
- Author:
- ralph
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the stream.protected voidHandles all comments that were registered for current row.protected voiddeliverComments(int rowIndex) Handles all comments that were registered for current row.Returns the attribute name of column tag that will contain the attribute name.Returns the column tag name.Returns the attribute name of column tag that contains the type of value.Returns the row tag name.booleanhasNext()Returns true if there are more rows.protected voidinit()Initializes reader.protected voidInitializes the XML parser thread.booleanReturns whether column names will be used as column tag names.Object[]next()Returns the next row.protected voidReads the header row.protected voidReads the next row.voidreset()Resets the reader.voidsetColumnNameAttribute(String columnNameAttribute) Sets the attribute name of column tag that will contain the attribute name.voidsetColumnTagName(String columnTagName) Sets the column tag name.voidsetColumnTypeAttribute(String columnTypeAttribute) Sets the attribute name of column tag that contains the type of value.voidsetRowTagName(String rowTagName) Sets the row tag name.voidsetUseColumnNameTags(boolean useColumnNameTags) Sets whether column names will be used as column tag names.Methods inherited from class csv.impl.AbstractStreamTableReader
createInputStreamReader, createReader, getCharsetDecoder, getInputStream, getReader, remove, setCharset, setCharset, setCharsetDecoder, setInputStreamMethods inherited from class csv.impl.AbstractTableReader
convert, convert, convertArray, convertArray, get, getColumnIndex, getColumnType, getHeaderRow, getLineCount, getMapper, getMinimumColumnCount, getRowCount, hasHeaderRow, incrementLineCount, incrementRowCount, isHeaderRowRead, iterator, notifyComment, open, registerCommentCallBack, setColumnType, setHasHeaderRow, setHeaderRow, setHeaderRowRead, setMapper, setMinimumColumnCount, unregisterCommentCallBackMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
END_OF_FILE_INDEX
protected static final int END_OF_FILE_INDEX- See Also:
-
-
Constructor Details
-
XmlReader
public XmlReader()Constructor. -
XmlReader
Constructor.- Parameters:
in- stream to read
-
XmlReader
Constructor.- Parameters:
file- fiel to read- Throws:
FileNotFoundException- when the file cannot be found
-
XmlReader
Constructor.- Parameters:
file- file to read- Throws:
FileNotFoundException- when the file cannot be found
-
-
Method Details
-
init
protected void init()Initializes reader. -
close
public void close()Closes the stream.- Specified by:
closein interfaceTableReader- Overrides:
closein classAbstractStreamTableReader- See Also:
-
reset
public void reset()Resets the reader.- Specified by:
resetin interfaceTableReader- Overrides:
resetin classAbstractStreamTableReader- See Also:
-
hasNext
public boolean hasNext()Returns true if there are more rows.- See Also:
-
next
Returns the next row.- See Also:
-
readNextRow
protected void readNextRow()Reads the next row. -
readHeaderRow
protected void readHeaderRow()Reads the header row.- Overrides:
readHeaderRowin classAbstractTableReader- See Also:
-
initParser
protected void initParser()Initializes the XML parser thread. -
deliverComments
protected void deliverComments()Handles all comments that were registered for current row. -
deliverComments
protected void deliverComments(int rowIndex) Handles all comments that were registered for current row.- Parameters:
rowIndex- the index of the row to be processed
-
getRowTagName
Returns the row tag name.- Returns:
- the rowTagName
-
setRowTagName
Sets the row tag name.- Parameters:
rowTagName- the rowTagName to set
-
getColumnTagName
Returns the column tag name.- Returns:
- the columnTagName
-
setColumnTagName
Sets the column tag name.- Parameters:
columnTagName- the columnTagName to set
-
isUseColumnNameTags
public boolean isUseColumnNameTags()Returns whether column names will be used as column tag names.- Returns:
- the useColumnNameTags
-
setUseColumnNameTags
public void setUseColumnNameTags(boolean useColumnNameTags) Sets whether column names will be used as column tag names.- Parameters:
useColumnNameTags- the useColumnNameTags to set
-
getColumnNameAttribute
Returns the attribute name of column tag that will contain the attribute name. This information is required only whenisUseColumnNameTags()returns false.- Returns:
- the columnNameAttribute
-
setColumnNameAttribute
Sets the attribute name of column tag that will contain the attribute name. This information is required only whenisUseColumnNameTags()returns false.- Parameters:
columnNameAttribute- the columnNameAttribute to set
-
getColumnTypeAttribute
Returns the attribute name of column tag that contains the type of value. The type is the value class and usually being used for type conversion.- Returns:
- the columnTypeAttribute
-
setColumnTypeAttribute
Sets the attribute name of column tag that contains the type of value. The type is the value class and usually being used for type conversion.- Parameters:
columnTypeAttribute- the columnTypeAttribute to set
-