org.basex.build.file
Class CSVParser
java.lang.Object
org.basex.core.Proc
org.basex.build.Parser
org.basex.build.SingleParser
org.basex.build.file.CSVParser
public final class CSVParser
- extends SingleParser
This class parses files in the CSV format
and sends events to the specified database builder.
The parser provides some options, which can be specified via
SET PARSEROPT ...
:
separator
defines the column separator, which can be
comma
, semicolon
, or tab
(default: comma
).
header
specifies if the input file contains a header.
Can be set to yes
or no
(default: yes
)
format
specifies the XML format, which can be
simple
or verbose
(default: verbose
).
All options are separated by commas, and the keys and values are
separated by equality sign (=).
Example:
SET PARSEROPT separator=tab,format=simple,header=no; CREATE DB ...
Description: Use tabs as separator, choose simple XML format,
and indicate that the file contains no header.
- Author:
- BaseX Team 2005-12, BSD License, Christian Gruen
Field Summary |
static java.lang.String[] |
FORMATS
Formats. |
static java.lang.String[] |
SEPARATORS
Separators. |
Method Summary |
void |
parse()
Parses the current input. |
Methods inherited from class org.basex.core.Proc |
abort, checkStop, databases, det, detail, listen, proc, prog, progress, registered, registered, startTimeout, stop, stopTimeout, tit, title |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SEPARATORS
public static final java.lang.String[] SEPARATORS
- Separators.
FORMATS
public static final java.lang.String[] FORMATS
- Formats.
CSVParser
public CSVParser(IO source,
Prop pr)
throws java.io.IOException
- Constructor.
- Parameters:
source
- document sourcepr
- database properties
- Throws:
java.io.IOException
- I/O exception
parse
public void parse()
throws java.io.IOException
- Description copied from class:
SingleParser
- Parses the current input.
- Specified by:
parse
in class SingleParser
- Throws:
java.io.IOException
- I/O exception