org.knime.base.node.io.filereader
Class XMLPropsReader

java.lang.Object
  extended by org.knime.core.xml.XMLProperties
      extended by org.knime.base.node.io.filereader.XMLPropsReader
All Implemented Interfaces:
ErrorHandler

public class XMLPropsReader
extends XMLProperties

Adds support for the old XML property files. It will read the specified XML file and provides the values at its API.

Author:
Peter Ohl, University of Konstanz

Constructor Summary
XMLPropsReader(URL xmlURL)
          Initializes a new specification object for a FileTable using the XML URL which contains a link to the source file as well as other properties how to parse the input data file.
 
Method Summary
 String getBlockCommentLeft()
          Returns the string for the left block comment.
 String getBlockCommentRight()
          Returns the string for the right block comment.
 String getColumnDelimiter()
          Returns column delimiter string.
 String getColumnMissing(int index)
          Get the missing value designator for the specified column.
 String getColumnName(int index)
          Returns column name at index.
 DataType getColumnType(int index)
          Returns column type as DataType at index.
 URL getDataFileURL()
          Returns an URL of the input data file initialized with file name, protocol, host, and port as specified in the xml file.
 String getDataFileURLspec()
          Returns the locator of the input data file as specified in the XML file.
 String getId()
          Returns the file tables' id.
 String getLineComment()
          Returns line comment string.
 int getNumColumns()
          Returns number of columns as read from the xml file.
 String getQuoteEscape()
          Returns escape quote string.
 String getQuoteLeft()
          Returns the string for the left quote.
 String getQuoteRight()
          Returns the string for the right quote.
 String getRowDelimiter()
          Returns row delimiter string.
 String getRowPrefix()
          Returns the prefix for row keys.
 URL getXMLFileURL()
          Get the URL of the XML file this spec was build from.
 boolean isColumnHeaderSpecified()
          Returns true if column header is specified in the data file and must be read from data input file, otherwise false.
 boolean isRowHeaderSpecified()
          Returns true if row header is specified in the data file and must be read from data input file, otherwise false.
 
Methods inherited from class org.knime.core.xml.XMLProperties
error, fatalError, getAttributeValue, getAttributeValue, getNodeElement, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLPropsReader

public XMLPropsReader(URL xmlURL)
               throws IOException,
                      SAXException,
                      ParserConfigurationException
Initializes a new specification object for a FileTable using the XML URL which contains a link to the source file as well as other properties how to parse the input data file.

Parameters:
xmlURL - specifies the URL where to find the XML file
Throws:
IllegalArgumentException - if xmlURL is null.
IOException - if xmlURL is not valid
SAXException - parser exception
ParserConfigurationException - a parser configuration exception
Method Detail

getId

public String getId()
Returns the file tables' id.

Returns:
the id for this table

getColumnMissing

public String getColumnMissing(int index)
Get the missing value designator for the specified column.

Parameters:
index - the index of the column to get the missing value representation for
Returns:
the value of the missing attr of the specified column

getNumColumns

public int getNumColumns()
Returns number of columns as read from the xml file.

Returns:
number of columns specified in the xml file
Throws:
NumberFormatException - if value is not parsable as integer number

isColumnHeaderSpecified

public boolean isColumnHeaderSpecified()
Returns true if column header is specified in the data file and must be read from data input file, otherwise false.

Returns:
true if column header must be read from input file, otherwise false
Throws:
IllegalCharsetNameException - if attribute is not either of value true or false

getColumnName

public String getColumnName(int index)
Returns column name at index.

Parameters:
index - in column header.
Returns:
column name at index.
Throws:
IndexOutOfBoundsException - if index out of range or number of columns not specified in xml file

getColumnType

public DataType getColumnType(int index)
Returns column type as DataType at index.

Parameters:
index - in column header
Returns:
column type
Throws:
IndexOutOfBoundsException - if index out of range
IllegalCharsetNameException - if attribute value matches not one of the type: String, Integer, or Double.

getXMLFileURL

public URL getXMLFileURL()
Get the URL of the XML file this spec was build from.

Returns:
the URL of the XML file

getDataFileURLspec

public String getDataFileURLspec()
Returns the locator of the input data file as specified in the XML file. It will not try to create an URL from it (in case it is malformed). It will return a (not null) string of the form (parts in brackets are optional): "['protocol':]['host'//][:'port]filename"

Returns:
a non-null string containing the data file URL specifier from the XML file

getDataFileURL

public URL getDataFileURL()
                   throws MalformedURLException
Returns an URL of the input data file initialized with file name, protocol, host, and port as specified in the xml file. If a relative URL was specified it is being relativized against the URL of the XML file.

Returns:
input file URL or null if not available
Throws:
MalformedURLException - if the URL cannot be initialized

getColumnDelimiter

public String getColumnDelimiter()
Returns column delimiter string.

Returns:
column delimiter string or null if not available

isRowHeaderSpecified

public boolean isRowHeaderSpecified()
Returns true if row header is specified in the data file and must be read from data input file, otherwise false.

Returns:
true if row header must be read from input file, otherwise false
Throws:
IllegalCharsetNameException - if attribute is not either of value true or false

getRowPrefix

public String getRowPrefix()
Returns the prefix for row keys.

Returns:
row key prefix or null if not available

getRowDelimiter

public String getRowDelimiter()
Returns row delimiter string.

Returns:
row delimiter string or null if not available

getLineComment

public String getLineComment()
Returns line comment string.

Returns:
the line comment string or null if not available

getBlockCommentLeft

public String getBlockCommentLeft()
Returns the string for the left block comment.

Returns:
string for left block comment

getBlockCommentRight

public String getBlockCommentRight()
Returns the string for the right block comment.

Returns:
string for right block comment

getQuoteLeft

public String getQuoteLeft()
Returns the string for the left quote.

Returns:
string for left quote

getQuoteRight

public String getQuoteRight()
Returns the string for the right quote.

Returns:
string for right quote

getQuoteEscape

public String getQuoteEscape()
Returns escape quote string.

Returns:
the escape quote string


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.