I'm struggling with the following case. I've a XML file in the following format:
<event>
<attribute type="NAME">John</attribute>
<attribute type="TASK">Buy</attribute>
<attribute type="DATE">12052017</attribute>
</event>
<event>
<attribute type="NAME">John</attribute>
<attribute type="RESOURCE">Dollar</attribute>
<attribute type="DATE">13052017</attribute>
</event>
I need to transform it into a CSV file. The outcome should be:
John,Buy,,12052017
John,,Dollar,13052017
I'm using a small Python script I wrote for Notepad++ that searches and deletes everything that shouldn't be in the string. For example:
editor.rereplace('\r\n <attribute type="NAME">', '');
This works fine, but it messes up the sequence of attribute (since if it doesn't find <attribute type="TASK">
it doesn't places an extra ,
. The outcome then is:
John,Buy,12052017
John,Dollar,13052017
Making no difference between the attribute TASK and RESOURCE.
I've checked different topics but none really covered my question. Can somehelp me with a cheap trick or point me to a tool.
For my project I am using this python script: