2
XML:
<?xml version="1.0" encoding="UTF-8"?>
<clientes>
<cliente>
<nome>Cliente1</nome>
<contatos>
<contato>
<nome>Contato1</nome>
</contato>
<contato>
<nome>Contato2</nome>
</contato>
</contatos>
</cliente>
<cliente>
<nome>Cliente2</nome>
<contatos>
<contato>
<nome>Contato3</nome>
</contato>
<contato>
<nome>Contato4</nome>
</contato>
</contatos>
</cliente>
</clientes>
I need to save in the database in two tables, the CLIENT and their CONTACTS, but I can only get each TAG at once and they have no reference thus:
DataSet ds = new DataSet();
ds.ReadXml(caminho);
ds.Tables[0];
//Aqui consigo obter os clientes
ds.Tables[1];
//Aqui consigo obter os contatos
That way I can’t create the references, the keys in the CLIENT x CONTACT.
Using Linq I was navigating level by level of Xelement after creating Xdocument using a simple foreach
– GNULopes