Write an XML using C # XMLwriter from an Excel table

0

Hello, I've never used the XMLwriter before, this is something totally new to me. I have a table in excel and I need to create an XML file from it, the first column will be the main node, and every other column a sub-node (I'm sorry for the terms used, but I do not really understand anything about XML) is, the columns beyond the first can have more than one information, which will be separated by commas, and I need to create sub-sub-nodes for each of them.

I thought of a structure similar to:

<?xml version="1.0"?>
<productList xmlns="http://tempuri.org/po.xsd" versionDate="2018-01-01">
<productIndex EAN="123123123"> <!-- algum indexador como o EAN -->
        <name>ASDASD</name> <!-- informação da primeira coluna -->
    <types n="1"> <!-- a partir da segunda coluna, podem haver mais de uma informação no campo, essas informação são separadas por virgula, o numero "n" seria a quantidade de informações -->
        <type1>Prod</type1>
    </types>
    <locations n="2">
        <location1>B1</location1>
        <location2>C3</location2>
    </locations>
</productIndex>
<productIndex EAN="321312312">
        <name>WASD</name>
    <types n="2"> <!-- nesse caso, o campo "types" tem mais de uma informação -->
        <type1>Prod</type1>
        <type2>Dimp</type2> <!-- cada novo "sub-node" seguindo o valor total do node "types"-->
    </types>
        <locations n="1">
        <location1>B7</location1>
    </locations>
</productIndex>

As I said, I have no idea how to do this because I've never worked with XML (or anything like that) before, so any help would be welcome.

I'm sorry for posting in English.

    
asked by anonymous 16.01.2018 / 23:57

0 answers