atviriduomenys / spinta

Spinta is a framework to describe, extract and publish data (a DEP Framework).
MIT License
10 stars 4 forks source link

`spinta inspect` for XML incorrectly adds `[]` for properties made from elements #633

Closed karina-klinkeviciute closed 3 weeks ago

karina-klinkeviciute commented 3 weeks ago

Example:

I have XML data like this:

<city>
    <name>
        Kaunas
    </name>
    <population>
        200000
    </population>
    <country>
        Lietuva
    </country>
        <name>
        Vilnius
    </name>
    <population>
        800000
    </population>
    <country>
        Lietuva
    </country>
</city>

and after running spinta inspect -r xml data.xml -o data.xslx I get this result:

id | d | r | b | m | property     | type    | ref | source     | prepare | level | access | uri | title | description
   | dataset                      |         |     |            |         |       |        |     |       |
   |   | resource                 | xml     |     | data.xml   |         |       |        |     |       |
   |                              |         |     |            |         |       |        |     |       |
   |   |   |   | City             |         |     | /city      |         |       |        |     |       |
   |   |   |   |   | name[]       | string  |     | name       |         |       |        |     |       |
   |   |   |   |   | population[] | integer |     | population |         |       |        |     |       |
   |   |   |   |   | country[]    | string  |     | country    |         |       |        |     |       |

It should be like this:

id | d | r | b | m | property     | type    | ref | source     | prepare | level | access | uri | title | description
   | dataset                      |         |     |            |         |       |        |     |       |
   |   | resource                 | xml     |     | data.xml   |         |       |        |     |       |
   |                              |         |     |            |         |       |        |     |       |
   |   |   |   | City             |         |     | /city      |         |       |        |     |       |
   |   |   |   |   | name         | string  |     | name       |         |       |        |     |       |
   |   |   |   |   | population   | integer |     | population |         |       |        |     |       |
   |   |   |   |   | country      | string  |     | country    |         |       |        |     |       |

Here, property names name[] should instead be name, country[] should be country and population[] should be population.

karina-klinkeviciute commented 3 weeks ago

it seems that the XML data was formatted incorrectly, that's why I got incorrect data. I think this can be closed.