0

I have this xml

<root>
<employee>
<firstname>Francis</firstname>
<lastname>Ferns</lastname>
<email protected=\"1\"/>
</employee>
</root>

This when being read from an DataSet reads two datables where another table gets added for the email . This is how the dataset visual looks like.

Employee email table email employee table

Instead of reading the attributed column protected in another table i would like it to be apart of the employee table itself with the protected column preceded with a "." and the employee table.

Is there in any way i could define the dataset schema so that so that all attributes be read as a part of the parent table ?

user581157
  • 1,327
  • 4
  • 26
  • 64

1 Answers1

0
Option Infer On

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim ds = New DataSet
    ds.ReadXml("c:\test.xml")

    ds.Tables("Employee").Columns.Add("protected", GetType(String))
    For Each row As DataRow In ds.Tables("Employee").Rows
        row("Protected") = row.GetChildRows(ds.Relations(0))(0)("Protected")
    Next

    ds.Tables("Email").Constraints.Clear()
    ds.Tables("Employee").Constraints.Clear()
    ds.Relations.Clear()
    ds.Tables.Remove("email")
End Sub

End Class
ileff
  • 358
  • 2
  • 5