Skip to content

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

@dbooth-boston

Description

@dbooth-boston

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions