Reputation: 423
I know how to do this for simple xml like-
<person>
<age>10</age>
<weight>20</weight>
</person>
will be mapped to CSV as-
age,weight
10,20
But how to do it for nested tags? Example: I have following xml-
<root>
<prop1>someValue</prop>
<prop2>
<innerProp>
<property1>value1</property1>
<property2>
<subProperty1>value2</subProperty1>
<subProperty2>value3</subProperty2>
<subProperty3>value4</subProperty3>
</property2>
<property3>value5</property3>
<property4>value6</property4>
<property5>
<subProperty4>value7</subProperty4>
<subProperty5>value8</subProperty5>
<subProperty6>value9</subProperty6>
</property5>
<property6>value10</property6>
<property7>value11</property>
</innerProp>
</prop2>
</root>
What will be its transformation in CSV? Or this can't be done at all?
Upvotes: 0
Views: 98
Reputation: 383
You could flatten this by using a dot for each indent you see. This would be the outcome:
prop1, prop2.innerProp.property1, prop2.innerProp.property2.subProperty1, prop2.innerProp.property2.subProperty2, ...
Upvotes: 2