I have 2 XML file.
First XML file:
="1.0"="utf-8"
<Books>
<Book bookId="100" name="Asp.Net" price = "230" />
<Book bookId="101" name="C#" price = "200" />
<Book bookId="102" name="Silverlight" price = "300" />
<Book bookId="103" name="MFC Book" price = "300" />
</Books>
Second XML file:
="1.0"="utf-8"
<Books>
<Book bookId="100" name="Asp.Net" price = "230" />
<Book bookId="101" name="C#" price = "200" />
<Book bookId="102" name="Silverlight" price = "300" />
<Book bookId="104" name="WPF" price = "200" />
<Book bookId="105" name="WCF" price = "200" />
</Books>
First of all I need to compare these two XML files.
If there is any difference between these XML files I need to receive an E-mail alert.
The received E-mail should be like this for example:
Inserted 2 id
<Books>
<Book bookId="104" name="WPF" price = "200" />
<Book bookId="105" name="WCF" price = "200" />
</Books>
Deleted 1 id
<Book bookId="103" name="MFC Book" price = "300" />
This is my coding, but the result is not exactly what I was looking for.
Dim description, filepath
Dim xmlDoc1 = CreateObject("Msxml2.DOMDocument")
xmlDoc1.load("D:406tree.xml")
Dim xmlDoc2 = CreateObject("Msxml2.DOMDocument")
xmlDoc2.load("D:406tree_en.xml")
Dim ElemList1 = xmlDoc1.DocumentElement.ChildNodes
Dim ElemList2 = xmlDoc2.DocumentElement.ChildNodes
If ElemList1.length = ElemList2.length Then
MsgBox("Both XML files have same number of Child nodes")
For i = 0 To ElemList1.length - 1
If ElemList1.item(i).Text = ElemList2.item(i).Text Then
MsgBox("child element:" & i & " is same in both XML files")
Else
MsgBox("child element:" & i & " is not same in both XML files, In XML file 1, The value is:" & ElemList1.item(i).Text &
" and In XML file 2, The value is:" & ElemList2.item(i).Text)
End If
Next
End If
Is it possible?
I am new to . Net
Please help me someone?