File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -436,17 +436,25 @@ public boolean exportToXML(File xmlFile) throws IOException {
436
436
final String NEW_LINE_SEPARATOR = "\n " ;
437
437
final String SINGLE_TAB = "\t " ;
438
438
final String DOUBLE_TAB = "\t \t " ;
439
+ final String XMLVERSION_AND_ENCODING ="<?xml version=\" 1.0\" encoding=\" utf-8\" ?>" ;
439
440
ArrayList <ArrayList <String >> tabelData = this .getFullTable ();
440
441
FileWriter writer = null ;
441
442
Integer count = 0 ;
442
443
try {
443
444
xmlFile .createNewFile ();
444
445
writer = new FileWriter (xmlFile );
446
+ writer .append (XMLVERSION_AND_ENCODING +NEW_LINE_SEPARATOR );
445
447
writer .append (TAG_OPENING +"Table" +TAG_CLOSING );
446
448
for (ArrayList <String > row : tabelData ){
447
449
count ++;
450
+ if (count == 1 ){
451
+ writer .append (NEW_LINE_SEPARATOR +SINGLE_TAB +TAG_OPENING +"Column key=" +row .get (0 )+TAG_CLOSING +NEW_LINE_SEPARATOR );
452
+ for (int i =1 ;i <row .size ();i ++){
453
+ writer .append (DOUBLE_TAB +TAG_OPENING +"data" +TAG_CLOSING +row .get (i )+TAG_OPENING_WITH_CLOSE +"data" +TAG_CLOSING +NEW_LINE_SEPARATOR );
454
+ }
455
+ }
448
456
if (count != 1 ){
449
- writer .append (NEW_LINE_SEPARATOR +SINGLE_TAB +TAG_OPENING +"row key=" +row .get (0 )+TAG_CLOSING +NEW_LINE_SEPARATOR );
457
+ writer .append (NEW_LINE_SEPARATOR +SINGLE_TAB +TAG_OPENING +"Row key=" +row .get (0 )+TAG_CLOSING +NEW_LINE_SEPARATOR );
450
458
for (int i =1 ;i <row .size ();i ++){
451
459
writer .append (DOUBLE_TAB +TAG_OPENING +"data" +TAG_CLOSING +row .get (i )+TAG_OPENING_WITH_CLOSE +"data" +TAG_CLOSING +NEW_LINE_SEPARATOR );
452
460
}
You can’t perform that action at this time.
0 commit comments