XML view to display in grid view
-
----The Sample XML File
DEVSTUDIO Microsoft Windows Server 2008 R2 Standard
------------------ The above is my xml file, i am using dataset to populate in the gridview i am able to get the child node information but along with parent i am unable to do it. PFB the code Dim Opf As New OpenFileDialog() Opf.Filter = "XML File | *.xml" Opf.FileName = "" If Opf.ShowDialog() = DialogResult.OK Then Dim fcontent As String Dim fpath As String fpath = Opf.FileName Using sr As StreamReader = New StreamReader(fpath) DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells DataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True fcontent = sr.ReadToEnd 'MsgBox(fcontent) Dim sfcontent As StringReader sfcontent = New StringReader(fcontent) Dim doc As XmlDocument = New XmlDocument() doc.Load(sfcontent) Dim naudit As XmlNode = doc.SelectSingleNode("/AuditResult/@name") Dim naudita = naudit.InnerText nlblaudit.Text = naudita Dim nauditc As XmlNode = doc.SelectSingleNode("/AuditResult/@created") Dim naudit1 = nauditc.InnerText Dim nauditb As XmlNode = doc.SelectSingleNode("/AuditResult/@type") Dim naudit2 = nauditb.InnerText nlblauditcreated.Text = naudit2 & " - Created" & " : " & naudi