File tree 4 files changed +19
-6
lines changed
src/main/java/com/codepressed/CSVtoXML
4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -40,11 +40,8 @@ public static void main(String[] args) {
40
40
}
41
41
42
42
try {
43
- //ArrayList of ArrayStrings Generation with CSV
44
43
ArrayList <String []> elements ;
45
44
elements = new Reader ().CSVtoArrayList (csvFile , csvSplit );
46
-
47
- //XML Doc Generation with ArrayList
48
45
Document xmlDoc ;
49
46
xmlDoc = new XMLDoc ().docBuilder (elements , elementName );
50
47
XMLTransformer .transformDocToFile (xmlDoc , xmlFile );
Original file line number Diff line number Diff line change 6
6
7
7
public class Reader {
8
8
9
- //ArrayList Generation ArrayStrings with the CSV Data
9
+ /**
10
+ *
11
+ * @param csvFile Input file
12
+ * @param csvSplit Invalid chars filter
13
+ * @return ArrayList of CSV Values
14
+ * @throws IOException
15
+ */
10
16
public ArrayList <String []> CSVtoArrayList (String csvFile , String csvSplit ) throws IOException {
11
17
ArrayList <String []> elements = new ArrayList <String []>();
12
18
BufferedReader csvReader = null ;
Original file line number Diff line number Diff line change 12
12
13
13
public class XMLDoc {
14
14
15
- //DOC Generation -> XML with ArrayList String elements
15
+ /**
16
+ *
17
+ * @param XMLelements ArrayList of CSV Values
18
+ * @param elementName Name fixed for node tree
19
+ * @return Final doc
20
+ * @throws ParserConfigurationException
21
+ */
16
22
public Document docBuilder (ArrayList <String []> XMLelements , String elementName ) throws ParserConfigurationException {
17
23
if (elementName == null ){
18
24
elementName = "element" ;
Original file line number Diff line number Diff line change 13
13
import java .io .FileOutputStream ;
14
14
15
15
public class XMLTransformer {
16
- //XML Generation -> Transform DOC Data to XML Format
16
+ /** Transforms DOC Data to XML Format
17
+ * @param xmlDoc
18
+ * @param xmlFile
19
+ * @throws TransformerException
20
+ */
17
21
public static void transformDocToFile (Document xmlDoc , String xmlFile ) throws TransformerException {
18
22
TransformerFactory xmlTransformerFactory = TransformerFactory .newInstance ();
19
23
Transformer xmlTransformer = xmlTransformerFactory .newTransformer ();
You can’t perform that action at this time.
0 commit comments