09-07-16, 04:02 PM
الكود
يحدث خطأ فى nod.ParentNode.ReplaceChild(nod, nod2)
ملف xml على هذه الصورة
كود :
Dim xd As New XmlDocument()
xd.Load(Application.StartupPath + "\test.xml")
Dim nod As XmlNode = xd.SelectSingleNode("//Test//prof[@Name='Ahmed'] [@Age='20'] [@Data='1']")
Dim nod2 As XmlNode = xd.SelectSingleNode("//Test//prof[@Name='Mohamed'] [@Age='18'] [@Data='20']")
If nod IsNot Nothing Then
nod.ParentNode.ReplaceChild(nod, nod2)
xd.Save(Path)
End If
ملف xml على هذه الصورة
إقتباس :<?xml version="1.0" encoding="utf-8"?>
<Test>
<prof Name="Ahmed" Age="20">
<?Data ="1"?>
<?Data ="2"?>
<?Data ="3"?>
</prof>
</Test>