Package csv.impl

Class XmlReader

All Implemented Interfaces:
TableReader, java.lang.Iterable<java.lang.Object[]>, java.util.Iterator<java.lang.Object[]>

public class XmlReader
extends AbstractStreamTableReader
Reads from a XML file.
Author:
ralph
  • Field Details

  • Constructor Details

    • XmlReader

      public XmlReader()
      Constructor.
    • XmlReader

      public XmlReader​(java.io.InputStream in)
      Constructor.
      Parameters:
      in - stream to read
    • XmlReader

      public XmlReader​(java.io.File file) throws java.io.FileNotFoundException
      Constructor.
      Parameters:
      file - fiel to read
      Throws:
      java.io.FileNotFoundException - when the file cannot be found
    • XmlReader

      public XmlReader​(java.lang.String file) throws java.io.FileNotFoundException
      Constructor.
      Parameters:
      file - file to read
      Throws:
      java.io.FileNotFoundException - when the file cannot be found
  • Method Details

    • close

      public void close()
      Closes the stream.
      Specified by:
      close in interface TableReader
      Overrides:
      close in class AbstractStreamTableReader
      See Also:
      AbstractStreamTableReader.close()
    • reset

      public void reset()
      Resets the reader.
      Specified by:
      reset in interface TableReader
      Overrides:
      reset in class AbstractStreamTableReader
      See Also:
      AbstractStreamTableReader.reset()
    • hasNext

      public boolean hasNext()
      Returns true if there are more rows.
      See Also:
      Iterator.hasNext()
    • next

      public java.lang.Object[] next()
      Returns the next row.
      See Also:
      Iterator.next()
    • readNextRow

      protected void readNextRow()
      Reads the next row.
    • readHeaderRow

      protected void readHeaderRow()
      Reads the header row.
      Overrides:
      readHeaderRow in class AbstractTableReader
      See Also:
      AbstractTableReader.readHeaderRow()
    • 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

      public java.lang.String getRowTagName()
      Returns the row tag name.
      Returns:
      the rowTagName
    • setRowTagName

      public void setRowTagName​(java.lang.String rowTagName)
      Sets the row tag name.
      Parameters:
      rowTagName - the rowTagName to set
    • getColumnTagName

      public java.lang.String getColumnTagName()
      Returns the column tag name.
      Returns:
      the columnTagName
    • setColumnTagName

      public void setColumnTagName​(java.lang.String columnTagName)
      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

      public java.lang.String getColumnNameAttribute()
      Returns the attribute name of column tag that will contain the attribute name. This information is required only when isUseColumnNameTags() returns false.
      Returns:
      the columnNameAttribute
    • setColumnNameAttribute

      public void setColumnNameAttribute​(java.lang.String columnNameAttribute)
      Sets the attribute name of column tag that will contain the attribute name. This information is required only when isUseColumnNameTags() returns false.
      Parameters:
      columnNameAttribute - the columnNameAttribute to set
    • getColumnTypeAttribute

      public java.lang.String 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

      public void setColumnTypeAttribute​(java.lang.String columnTypeAttribute)
      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