Linq
Linq
Products.xml Users.xml
<?xml version="1.0" standalone="yes"?> <?xml version="1.0" standalone="yes"?>
<NewDataSet> <NewDataSet>
<Table> <Table>
<ItemID>1</ItemID> <userId>1</userId>
<UserID>1</UserID> <firstName>Sunil</firstName>
<ProductName>SOAP</ProductName> <lastName>krishna</lastName>
<Price>50</Price> <companyName>Assyst</companyName>
</Table> </Table>
<Table> <Table>
<ItemID>2</ItemID> <userId>2</userId>
<UserID>2</UserID> <firstName>JOMY</firstName>
<ProductName>BOOK</ProductName> <lastName>krishna</lastName>
<Price>40</Price> <companyName>Assyst</companyName>
</Table> </Table>
<Table> <Table>
<ItemID>3</ItemID> <userId>3</userId>
<UserID>3</UserID> <firstName>ANAS</firstName>
<ProductName>PEN</ProductName> <lastName>krishna</lastName>
<Price>50</Price> <companyName>Assyst</companyName>
</Table> </Table>
<Table> <Table>
<ItemID>4</ItemID> <userId>4</userId>
<UserID>5</UserID> <firstName>Aneesh</firstName>
<ProductName>PENCIL</ProductName> <lastName> </lastName>
<Price>50</Price> <companyName> </companyName>
</Table> </Table>
</NewDataSet> </NewDataSet>
doc2.LoadXml(rawXML1)
ds.ReadXml(New XmlNodeReader(doc2))
GridData.DataSource = ds
ADD ROW IN XML
Dim ds As New DataSet
strpath = "tbl_users.xml"
xmlDoc.Load(strpath)
parent.AppendChild(row)
TxtBox1.Text = parent.ChildNodes.Count
xmlDoc.Save(strpath)
ds.ReadXml(strpath)
GridData.DataSource = ds
UPDATION IN XML
Dim loNode As XmlNode
xmlDoc.Load(strpath)
Dim intId As Integer
intId = GridData.Selected.Rows(0).Cells(0).Text
TxtBox1.Text = intId
loNode = xmlDoc.SelectSingleNode("NewDataSet/Table[userId='" & TxtBox1.Text & "']")
loNode("userId").InnerText = Val(TxtBox1.Text)
loNode("firstName").InnerText = TxtBox2.Text '' set the new values of the row’s fields
loNode("lastName").InnerText = TxtBox3.Text
loNode("companyName").InnerText = TxtBox4.Text
loNode("userName").InnerText = TxtBox4.Text
loNode("password").InnerText = TxtBox5.Text
' ''Dim x = xmlDoc.GetElementsByTagName("lastName")
' ''MsgBox(loNode.InnerText)
' ''For i = 1 To x.Count - 1
' '' MsgBox(x.Item(i).InnerText)
' ''Next
xmlDoc.Save(strpath)
ds.ReadXml(strpath)
GridData.DataSource = ds
DELETION IN XML
strpath = "tbl_users.xml"
Dim ds As New DataSet
With GridData
Dim intId As Integer
intId = .Selected.Rows(0).Cells(0).Text
xmlDoc.Load(strpath)
Dim row As XmlNode = xmlDoc.SelectSingleNode("NewDataSet/Table[userId='" & intId & "']")
row.ParentNode.RemoveChild(row)
xmlDoc.Save(strpath)
ds.ReadXml(strpath)
GridData.DataSource = ds
End With
XML ENCRYPTION
XSL
New1.xsl
New.xml