tiagoa77 / xml2csv-conv

Automatically exported from code.google.com/p/xml2csv-conv
0 stars 0 forks source link

Output missing the last record #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a file called records.xml with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<collection>
  <record>
    <datafield tag="020">
      <subfield code="a">version</subfield>
    </datafield>
    <datafield tag="040">
      <subfield code="b">stuff</subfield>
    </datafield>
  </record>
  <record>
    <datafield tag="020">
      <subfield code="a">version1</subfield>
      <subfield code="9">annotation1</subfield>
    </datafield>
    <datafield tag="020">
      <subfield code="a">version2</subfield>
      <subfield code="9">annotation2</subfield>
    </datafield>
    <datafield tag="040">
      <subfield code="b">yadda</subfield>
    </datafield>
  </record>
</collection>

2. Execute the following:
   xml2csv-conv.bat -l datafield records.xml records.csv

What is the expected output? 

See one row for each datafield element in the .xml file.

What do you see instead?

All datafield records except the last one are output to the .csv file.

What version of the product are you using? On what operating system?

Latest downloaded today 2012/04/10

Please provide any additional information below.

Windows, JDK 1.6.0_29

Original issue reported on code.google.com by chr...@stepaheadsoftware.com on 10 Apr 2012 at 5:32

GoogleCodeExporter commented 8 years ago
I too have just come across this problem (I.E. last instance of selected field 
NOT being extracted/recorded in the output file) and this problem should be 
addressed URGENTLY as to be missing (for our example) a new customer record 
detail could be bad for business.

Original comment by slsglob...@slsglobals.karoo.co.uk on 21 Aug 2012 at 2:12

GoogleCodeExporter commented 8 years ago
I have also encountered the same problem ! 

Original comment by robinga...@gmail.com on 19 Nov 2012 at 8:35

GoogleCodeExporter commented 8 years ago
I have the same issue. did anyone found how to solve this ? thanks

Original comment by ste.ka...@gmail.com on 18 Jan 2013 at 11:14

GoogleCodeExporter commented 8 years ago
I have consistently experienced this issue.  I have tried changing the order of 
the fields, including parent/child fields - have not been able to find a way to 
retain the last record.  

Original comment by coldit...@gmail.com on 1 Mar 2013 at 10:37

GoogleCodeExporter commented 8 years ago
You have to change the code. Add this.printMapToResult(values); at line 199 in 
Main.java and rebuild the application. All necessary files can be found in 
source tab on this website.

Main.java should look like this:
...
198 this.parseValues((Node) root, 0);
199 this.printMapToResult(values);
200 return this.result;
...

In attachment, I dropped the new .jar file (so you don't have to rebuild 
yourself). For me it works fine with this new .jar.

Original comment by Stijn.Be...@gmail.com on 13 Nov 2013 at 10:00

Attachments: