Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing element causes cell data to appear in the wrong column #44

Open
dbooth-boston opened this issue Jun 16, 2018 · 0 comments
Open

Comments

@dbooth-boston
Copy link

If an element is missing in the source XML, then the corresponding cell is erroneously omitted from the resulting CSV. This causes values in the resulting CSV to appear in the wrong columns.

This command:

xml2csv --input in.xml --output out.csv --tag "row"

On this input file, in.xml:

<?xml version="1.0"?>
<top>
  <row>
    <a>r1_col_a</a>
    <b>r1_col_b</b>
  </row>
  <row>
    <b>r2_col_b</b>
  </row>
</top>

Produced this output file, out.csv:

a,b
"r1_col_a","r1_col_b"
"r2_col_b"

Notice that r2_col_b is in column a, when it should be in column b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant