This class is defined in the following book "Java and XSLT" by Eric M. Burke (O'Reilly)
- Author:
- triolet
Constructor Summary |
CSVXMLReader(java.lang.String separator)
|
Method Summary |
private java.lang.String |
cleanupQuotes(java.lang.String token)
Removes quotes around a token |
private int |
locateFirstDelimiter(java.lang.String curLine)
Locates the first separator character in the current line |
void |
parse(org.xml.sax.InputSource input)
Analyses a CSV file. |
private void |
parseLine(java.lang.String curLine,
org.xml.sax.ContentHandler ch)
Recursive analyse of a line |
void |
setSeparator(java.lang.String separator)
Sets the separator attribute of the CSVXMLReader object |
Methods inherited from class fr.fluxmedia.tmcontrib.generator.AbstractXMLReader |
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getProperty, parse, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setProperty |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMPTY_ATTR
private static final org.xml.sax.Attributes EMPTY_ATTR
separator
private char separator
CSVXMLReader
public CSVXMLReader(java.lang.String separator)
parse
public void parse(org.xml.sax.InputSource input)
throws java.io.IOException,
org.xml.sax.SAXException
- Analyses a CSV file. SAX2 events are sending to the ContentHandler.
- Specified by:
parse
in interface org.xml.sax.XMLReader
- Specified by:
parse
in class AbstractXMLReader
- Parameters:
input
- The input to parse
- Throws:
java.io.IOException
- if input has not been found
org.xml.sax.SAXException
- an exception that can wrap others exceptions
setSeparator
public void setSeparator(java.lang.String separator)
- Sets the separator attribute of the CSVXMLReader object
- Parameters:
separator
- The new separator value
parseLine
private void parseLine(java.lang.String curLine,
org.xml.sax.ContentHandler ch)
throws java.io.IOException,
org.xml.sax.SAXException
- Recursive analyse of a line
- Parameters:
curLine
- The current linech
- The contentHandler which receives SAX2 events
- Throws:
java.io.IOException
- if an I/O operation failed.
org.xml.sax.SAXException
- an exception that can wrap others exceptions
locateFirstDelimiter
private int locateFirstDelimiter(java.lang.String curLine)
- Locates the first separator character in the current line
- Parameters:
curLine
- The current line
- Returns:
- The index of the first separator character in the line, -1 if not found
cleanupQuotes
private java.lang.String cleanupQuotes(java.lang.String token)
- Removes quotes around a token
- Parameters:
token
- The token with quotes to remove
- Returns:
- The token without quotes
..no bottom yet...