I have 2 XML files with same DTD ,i want to merge both the XML files,through VB
Thanks in advance
Regards
Nit
Printable View
I have 2 XML files with same DTD ,i want to merge both the XML files,through VB
Thanks in advance
Regards
Nit
Use the DOM!
The steps should be:
Try to implement this steps. If there special questions post them!Code:Create DOMDocument of the first XML File.
Create DOMDocument of the second XML File.
Create new DOMDocument
For each Element in the First DOMDocument
add this Element to the new DOMDocument
next Element
For each Element in the Second DOMDocument
add this Element to the new DOMDocument
next Element
Save the new Document
Thats fine but what if both files have same record?
Try this:
hope this helps...Code:Create DOMDocument of the first XML File.
Create DOMDocument of the second XML File.
Create new DOMDocument
'add all elements of the first DOMDocument
For each Element in the First DOMDocument
add this Element to the new DOMDocument
next Element
'add those elements of the second that are not in the first
for each Element in the Second DOMDocument
check if this element in the first DOMDocument by compare with each Element if it
if not found in first DOMDocument
add this element to the new DOMDocument
endif
next Element
save the new DOMDocument