Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbdfe7a4

Browse files
author
A. Apesteguia
committed
Fixed no args bug
1 parentfc7d291 commitbdfe7a4

File tree

4 files changed

+46
-46
lines changed

4 files changed

+46
-46
lines changed

‎README.md‎

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ of nodes and tree structure.
1010

1111
The fields are separated by commas in the original file
1212

13-
_(You can find it[here](examples/grades.csv))_
13+
_(You can find it[here](examples/Grades.csv))_
1414
```
15-
Last nameFirst nameSSNTest1Test2Test3Test4FinalGrades
16-
AlfalfaAloysius123-45-6789 40.090.0 100.083.0 49.0D-
17-
AlfredUniversity123-12-1234 41.097.0 96.0 97.0 48.0D+
18-
GertyGramma567-89-0123 41.080.0 60.0 40.0 44.0C
19-
AndroidElectric087-65-4321 42.023.0 36.0 45.0 47.0B-
20-
BumpkinFred456-78-9012 43.078.0 88.0 77.0 45.0A-
21-
RubbleBetty234-56-7890 44.090.0 80.0 90.0 46.0C-
22-
NoshowCecil345-67-8901 45.011.0 -1.04.0 43.0F
23-
BuffBif632-79-9939 46.020.0 30.0 40.0 50.0B+
24-
AirpumpAndrew223-45-6789 49.01.0 90.0 100.0 83.0A
25-
BackusJim143-12-1234 48.01.0 97.0 96.0 97.0A+
26-
CarnivoreArt565-89-0123 44.01.0 80.0 60.0 40.0D+
27-
DandyJim087-75-4321 47.01.0 23.0 36.0 45.0C+
28-
ElephantIma456-71-9012 45.01.0 78.0 88.0 77.0B-
29-
FranklinBenny234-56-2890 50.01.0 90.0 80.0 90.0B-
30-
GeorgeBoy345-67-3901 40.01.0 11.0 -1.0 4.0B
31-
HeffalumpHarvey632-79-9439 30.01.0 20.0 30.0 40.0C
15+
Last nameFirst nameSSNTest1Test2Test3Test4FinalGrades
16+
AlfalfaAloysius123-45-6789 40.0 90.0100.0 83.0 49.0D-
17+
AlfredUniversity123-12-1234 41.0 97.0 96.0 97.0 48.0D+
18+
GertyGramma567-89-0123 41.0 80.0 60.0 40.0 44.0C
19+
AndroidElectric087-65-4321 42.0 23.0 36.0 45.0 47.0B-
20+
BumpkinFred456-78-9012 43.0 78.0 88.0 77.0 45.0A-
21+
RubbleBetty234-56-7890 44.0 90.0 80.0 90.0 46.0C-
22+
NoshowCecil345-67-8901 45.0 11.0 -1.0 4.0 43.0F
23+
BuffBif632-79-9939 46.0 20.0 30.0 40.0 50.0B+
24+
AirpumpAndrew223-45-6789 49.0 1.090.0100.0 83.0A
25+
BackusJim143-12-1234 48.0 1.097.0 96.0 97.0A+
26+
CarnivoreArt565-89-0123 44.0 1.080.0 60.0 40.0D+
27+
DandyJim087-75-4321 47.0 1.023.0 36.0 45.0C+
28+
ElephantIma456-71-9012 45.0 1.078.0 88.0 77.0B-
29+
FranklinBenny234-56-2890 50.0 1.090.0 80.0 90.0B-
30+
GeorgeBoy345-67-3901 40.0 1.011.0 -1.0 4.0B
31+
HeffalumpHarvey632-79-9439 30.0 1.020.0 30.0 40.0C
3232
3333
```
3434

3535
##XML Output file
36-
_(You can find it[here](examples/gradesOutput.xml))_
36+
_(You can find it[here](examples/Grades.xml))_
3737
```
3838
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
3939
<root>
@@ -221,6 +221,7 @@ _(You can find it [here](examples/gradesOutput.xml))_
221221
##License
222222
This project is licensed under the MIT License - see the[LICENSE.md](LICENSE.md) file for details.
223223

224-
##[Donate](http://paypal.me/apesteguia)
224+
##[Donate](https://www.paypal.me/apesteguia)
225225

226226
Any amount is welcome ☕💕
227+
[PayPal](https://www.paypal.me/apesteguia)
File renamed without changes.

‎src/main/java/com/codepressed/CSVtoXML/Main.java‎

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,42 @@
77
importjava.util.ArrayList;
88

99
publicclassMain {
10+
/**
11+
* Executes the CSV to XML conversion
12+
* @param args file input and output
13+
*
14+
*/
1015
publicstaticvoidmain(String[]args){
16+
//Arg validator
17+
if(args.length ==0)
18+
{
19+
System.out.println("You didn't type any args.");
20+
System.exit(0);
21+
}
22+
try {
1123

12-
/*/
13-
Vars Initialization
14-
*/
24+
//Vars Initialization
1525
StringcsvFile =args[0];
1626
StringxmlFile =args[1];
17-
//String csvFile = "C:\\Users\\Dani\\src\\CodepressedConverter\\examples\\grades.csv";
18-
//String xmlFile = "C:\\Users\\Dani\\src\\CodepressedConverter\\examples\\gradesOutput.xml";
1927

20-
/*
21-
ArrayList of ArrayStrings Generation with CSV
22-
*/
28+
//ArrayList of ArrayStrings Generation with CSV
2329
ArrayList<String[]>elements =null;
24-
try {
2530
elements =newReader().CSVtoArrayList(csvFile);
26-
}catch (IOExceptione) {
27-
System.out.println("File wasn't found, error: "+e);;
28-
}
2931

30-
/*/
31-
XML Doc Generation with ArrayList
32-
*/
32+
//XML Doc Generation with ArrayList
3333
DocumentxmlDoc =null;
34-
try {
3534
xmlDoc =newUtil().docBuilder(elements);
36-
}catch (ParserConfigurationExceptione) {
37-
System.out.println("Configuration error: "+e);;
38-
}
35+
Util.transformDocToFile(xmlDoc,xmlFile);
3936

40-
/*/
41-
Transform xml DOC to a xml FILE
42-
*/
43-
try {
44-
Util.transform(xmlDoc,xmlFile);
45-
}catch (TransformerExceptione) {
37+
}catch (IOExceptione) {
38+
e.printStackTrace();
39+
System.out.println("File wasn't found, error: "+e);
40+
}
41+
catch (TransformerExceptione){
4642
System.out.println("Transformer error: "+e);;
4743
}
44+
catch (ParserConfigurationExceptione) {
45+
System.out.println("Configuration error: "+e);
46+
}
4847
}
4948
}

‎src/main/java/com/codepressed/CSVtoXML/Util.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public Document docBuilder(ArrayList<String[]> elements) throws ParserConfigurat
7373
/*/
7474
XML Generation -> Transform DOC Data to XML Format
7575
*/
76-
publicstaticvoidtransform(DocumentxmlDoc,StringxmlFile)throwsTransformerException {
76+
publicstaticvoidtransformDocToFile(DocumentxmlDoc,StringxmlFile)throwsTransformerException {
7777
TransformerFactoryxmlTransformerFactory =TransformerFactory.newInstance();
7878
TransformerxmlTransformer =xmlTransformerFactory.newTransformer();
7979
xmlTransformer.setOutputProperty(OutputKeys.INDENT,"yes");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp