Write an XML using Xmlwriter C# from an Excel table

Asked

Viewed 67 times

0

Hi, I’ve never used Xmlwriter before, this is something totally new to me. I have a table in an excel and need to create an XML file from it, the first column will be the main Node, and each other column a sub-Node (I’m sorry for the terms used, but I really don’t understand XML), the point is, columns beyond the first can have more than one information, which will be separated by comma, 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 have never worked with XML (or things like that) before, so any help will be welcome.

I’m sorry I posted in English.

  • You talk and you read Português?

  • You are on https://answall.com, your question must be asked in English.

  • corrected, I apologize.

  • only the title was missing

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.