File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed
src/main/java/com/codepressed/CSVtoXML Expand file tree Collapse file tree 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) {
4040 }
4141
4242 try {
43- //ArrayList of ArrayStrings Generation with CSV
4443 ArrayList <String []> elements ;
4544 elements = new Reader ().CSVtoArrayList (csvFile , csvSplit );
46-
47- //XML Doc Generation with ArrayList
4845 Document xmlDoc ;
4946 xmlDoc = new XMLDoc ().docBuilder (elements , elementName );
5047 XMLTransformer .transformDocToFile (xmlDoc , xmlFile );
Original file line number Diff line number Diff line change 66
77public class Reader {
88
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+ */
1016 public ArrayList <String []> CSVtoArrayList (String csvFile , String csvSplit ) throws IOException {
1117 ArrayList <String []> elements = new ArrayList <String []>();
1218 BufferedReader csvReader = null ;
Original file line number Diff line number Diff line change 1212
1313public class XMLDoc {
1414
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+ */
1622 public Document docBuilder (ArrayList <String []> XMLelements , String elementName ) throws ParserConfigurationException {
1723 if (elementName == null ){
1824 elementName = "element" ;
Original file line number Diff line number Diff line change 1313import java .io .FileOutputStream ;
1414
1515public 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+ */
1721 public static void transformDocToFile (Document xmlDoc , String xmlFile ) throws TransformerException {
1822 TransformerFactory xmlTransformerFactory = TransformerFactory .newInstance ();
1923 Transformer xmlTransformer = xmlTransformerFactory .newTransformer ();
You can’t perform that action at this time.
0 commit comments