Package com.saxonica.functions.qt4.csv
Class CsvRepresentationGenerator
java.lang.Object
com.saxonica.functions.qt4.csv.CsvRepresentationGenerator
- Direct Known Subclasses:
CsvRecordGenerator,CsvXmlGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GroundedValueprotected booleanprotected final Map<String, GroundedValue> protected ItemMapper.Lambdaprotected final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ItemGenerate the item to be delivered as the function result, given the sequence of rows returned by the CSV parserprotected List<StringValue> generateColumnNames(ArrayItem firstRow) Extract the list of column names from an array item holding the contents of the first row, selecting and reordering the names if requiredprotected ItemMapper.LambdamakeRowTrimmer(int width) Make a mapping function that adjusts an array item representing one CSV row by truncating excess fields or adding empty fields as required
-
Field Details
-
options
-
extractHeaderRow
protected boolean extractHeaderRow -
trimRows
protected final boolean trimRows -
explicitColumnNames
-
rowAdjuster
-
-
Constructor Details
-
CsvRepresentationGenerator
- Throws:
XPathException
-
-
Method Details
-
makeRowTrimmer
Make a mapping function that adjusts an array item representing one CSV row by truncating excess fields or adding empty fields as required- Parameters:
width- the required number of fields in each row- Returns:
- a mapping function that can be used to adjust the rows as required
-
fromRowSequence
Generate the item to be delivered as the function result, given the sequence of rows returned by the CSV parser- Parameters:
rows- the rows returned by the CSV parser, as a sequence of XDM arrays of XDM strings- Returns:
- the data as appropriate to each subclass
- Throws:
XPathException- if anything goes wrong
-
generateColumnNames
Extract the list of column names from an array item holding the contents of the first row, selecting and reordering the names if required- Parameters:
firstRow- the first row of the data, containing column names- Returns:
- a list of column names in the order that the columns appear in the output
-