|
-
September 23rd, 2002, 11:40 PM
#1
Merge XML File
I have 2 XML files with same DTD ,i want to merge both the XML files,through VB
Thanks in advance
Regards
Nit
-
September 23rd, 2002, 11:47 PM
#2
Use the DOM!
The steps should be:
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
Try to implement this steps. If there special questions post them!
mfg Ungi
Music, music and VB. VB is like music: You never know how it is interpreted.
-
September 24th, 2002, 01:27 AM
#3
Thats fine but what if both files have same record?
-
September 24th, 2002, 01:32 AM
#4
Try this:
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
hope this helps...
mfg Ungi
Music, music and VB. VB is like music: You never know how it is interpreted.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|