Ciao
Poichè i nodi di un xml hanno una struttura nidificata, per leggere tutti i nodi figlio di ciascun nodo dell'xml devi usare una funzione ricorsiva.
C'è un articolo sulle funzioni ricorsive qui su dotnethell:
http://www.dotnethell.it/articles/FunzioniRicorsive.aspx
Un esempio per ciò che vuoi fare te potrebbe essere questo:
Private Sub ReadXml(ByVal nodeList As XmlNodeList, ByVal dt1 As DataTable)
Dim row1 As DataRow
For Each childNode As XmlNode In nodeList
row1 = dt1.NewRow
dt1.Rows.Add(row1)
'frmProcesso.dgvCampi.Rows(x).Cells(1).Value = ele.Name.ToString
row1(1) = childNode.Name
'MsgBox(childNode.Name)
ReadXml(childNode.ChildNodes, dt1)
Next
End Sub
Che nel tuo codice chiameresti passando come argomenti DocXML.ChildNodes e dt1:
'Ho commentato le righe che non dovrebbero più servirti
filepath = TBFilexml.Text
Dim DocXML As New Xml.XmlDocument
DocXML.Load(filepath)
filepath = TBFilexsd.Text
Dim DocXSD As New DataSet
DocXSD.ReadXmlSchema(filepath)
'Dim node As Xml.XmlNodeList
'Dim ele As Xml.XmlElement
'node = DocXML.DocumentElement.FirstChild.ChildNodes
'Dim x As Integer
dt1 = frmProcesso.dgvCampi.DataSource
''aggiunge i campi in dgvcampi
'Dim row1 As DataRow
'For x = 0 To node.Count - 1
' row1 = dt1.NewRow
' dt1.Rows.Add(row1)
' ele = node(x)
' frmProcesso.dgvCampi.Rows(x).Cells(1).Value = ele.Name.ToString
'Next
ReadXml(DocXML.ChildNodes, dt1) 'Questa è la chiamata alla funzione ricorsiva
dset2.Tables.Add(frmProcesso.dgvCampi.DataSource)
Il risultato dovrebbe essere giusto, ma se ci sono problemi dillo
Luca