Package org.basex.io.parse.csv
Class CsvConverter
java.lang.Object
org.basex.core.jobs.Job
org.basex.io.parse.csv.CsvConverter
- Direct Known Subclasses:
CsvXQueryConverter
This class converts CSV input to XML.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanAttributes format.protected intCurrent column.static final byte[]CSV token.static final byte[]CSV token.protected final TokenListHeaders.protected final booleanLax QName conversion.static final byte[]CSV token.protected NewlineInputCurrent input.static final byte[]CSV token. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ItemConverts the specified input to an XQuery value.protected abstract voidentry(byte[] value) Called when an entry is encountered.protected abstract Itemfinish()Returns the resulting XQuery value.static CsvConverterget(CsvParserOptions copts) Returns a CSV converter for the given configuration.protected abstract voidheader(byte[] string) Adds a new header.protected abstract voidInitializes the conversion.protected abstract voidrecord()Adds a new record.
-
Field Details
-
CSV
public static final byte[] CSVCSV token. -
RECORD
public static final byte[] RECORDCSV token. -
ENTRY
public static final byte[] ENTRYCSV token. -
NAME
public static final byte[] NAMECSV token. -
headers
Headers. -
ats
protected final boolean atsAttributes format. -
lax
protected final boolean laxLax QName conversion. -
col
protected int colCurrent column. -
nli
Current input.
-
-
Constructor Details
-
CsvConverter
Constructor.- Parameters:
copts- json options
-
-
Method Details
-
convert
Converts the specified input to an XQuery value.- Parameters:
input- input- Returns:
- result
- Throws:
IOException- I/O exception
-
get
Returns a CSV converter for the given configuration.- Parameters:
copts- options- Returns:
- CSV converter
-
header
protected abstract void header(byte[] string) Adds a new header.- Parameters:
string- string
-
record
Adds a new record.- Throws:
IOException- I/O exception
-
entry
Called when an entry is encountered.- Parameters:
value- string- Throws:
IOException- I/O exception
-
init
Initializes the conversion.- Parameters:
uri- base URI
-
finish
Returns the resulting XQuery value.- Returns:
- result
- Throws:
IOException- I/O exception
-