com.fordfrog.xml2csv.DefaultCsvWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xml-to-csv Show documentation
Show all versions of xml-to-csv Show documentation
Forked version of fordfrog xml2csv library that allows selection of xml elements via attributes
The newest version!
package com.fordfrog.xml2csv;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
public class DefaultCsvWriter implements LineHandler {
private final Writer writer;
public DefaultCsvWriter() {
this(new StringWriter());
}
public DefaultCsvWriter(Writer writer) {
this.writer = writer;
}
@Override
public void handler(String line) {
try {
writer.append(line);
writer.append(System.lineSeparator());
} catch (IOException e) {
throw new Xml2CsvException(e);
}
}
}