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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the stream.protected void
Handles all comments that were registered for current row.protected void
deliverComments
(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.boolean
hasNext()
Returns true if there are more rows.protected void
init()
Initializes reader.protected void
Initializes the XML parser thread.boolean
Returns whether column names will be used as column tag names.Object[]
next()
Returns the next row.protected void
Reads the header row.protected void
Reads the next row.void
reset()
Resets the reader.void
setColumnNameAttribute
(String columnNameAttribute) Sets the attribute name of column tag that will contain the attribute name.void
setColumnTagName
(String columnTagName) Sets the column tag name.void
setColumnTypeAttribute
(String columnTypeAttribute) Sets the attribute name of column tag that contains the type of value.void
setRowTagName
(String rowTagName) Sets the row tag name.void
setUseColumnNameTags
(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, setInputStream
Methods 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, unregisterCommentCallBack
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods 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:
close
in interfaceTableReader
- Overrides:
close
in classAbstractStreamTableReader
- See Also:
-
reset
public void reset()Resets the reader.- Specified by:
reset
in interfaceTableReader
- Overrides:
reset
in 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:
readHeaderRow
in 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
-