BAEL-5755: indention update

This commit is contained in:
Vladyslav Chernov 2023-11-22 16:06:21 -08:00
parent ee97389e28
commit 7deec4a5e0
2 changed files with 11 additions and 11 deletions

View File

@ -40,7 +40,7 @@ public class Xml2CsvExample {
protected static void convertXml2CsvXslt(String xslPath, String xmlPath, String csvPath) throws IOException, TransformerException {
StreamSource styleSource = new StreamSource(new File(xslPath));
Transformer transformer = TransformerFactory.newInstance()
.newTransformer(styleSource);
.newTransformer(styleSource);
Source source = new StreamSource(new File(xmlPath));
Result outputTarget = new StreamResult(new File(csvPath));
transformer.transform(source, outputTarget);
@ -68,26 +68,26 @@ public class Xml2CsvExample {
if ("Bookstore".equals(currentElement)) {
bookstoreInfo.setLength(0);
bookstoreInfo.append(reader.getAttributeValue(null, "id"))
.append(",");
.append(",");
}
if ("Book".equals(currentElement)) {
csvRow.append(bookstoreInfo)
.append(reader.getAttributeValue(null, "id"))
.append(",")
.append(reader.getAttributeValue(null, "category"))
.append(",");
.append(reader.getAttributeValue(null, "id"))
.append(",")
.append(reader.getAttributeValue(null, "category"))
.append(",");
}
if ("Author".equals(currentElement)) {
csvRow.append(reader.getAttributeValue(null, "id"))
.append(",");
.append(",");
}
break;
case XMLStreamConstants.CHARACTERS:
if (!reader.isWhiteSpace()) {
csvRow.append(reader.getText()
.trim())
.append(",");
.trim())
.append(",");
}
break;

View File

@ -91,7 +91,7 @@ public class Xml2CsvExampleUnitTest {
Xml2CsvExample.convertXml2CsvXslt(STYLE_XSL, DATA_XML, TEMP_OUTPUT_CSV);
File csvFile = new File(TEMP_OUTPUT_CSV);
try(BufferedReader reader = new BufferedReader(new FileReader(csvFile))) {
try (BufferedReader reader = new BufferedReader(new FileReader(csvFile))) {
String line;
boolean isFirstLine = true;
while ((line = reader.readLine()) != null) {
@ -113,7 +113,7 @@ public class Xml2CsvExampleUnitTest {
Xml2CsvExample.convertXml2CsvStax(DATA_XML, TEMP_OUTPUT_CSV);
File csvFile = new File(TEMP_OUTPUT_CSV);
try(BufferedReader reader = new BufferedReader(new FileReader(csvFile))) {
try (BufferedReader reader = new BufferedReader(new FileReader(csvFile))) {
String line;
boolean isFirstLine = true;
while ((line = reader.readLine()) != null) {