Merge xml files and the other way

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts Page 1 of 1
Contributors
User avatar
AnoPem
VIP - Donator
VIP - Donator
Posts: 441
Joined: Sat Jul 24, 2010 10:55 pm

Merge xml files and the other way
AnoPem
Hello as title indicate i would like a tutorial on how i can merge multiple xml files into 1 bigger xml file and then split it again at a later time in vb.NET

This is much apreciated loove;
https://t.me/pump_upp
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

hello anopm,

no idea if this works i didn't tested it :)
hope this works out for you.
but split it again no idea
why even split it again if you merge them in 1 file :lol:
Code: Select all
        ' The actual "merge". 
        ' The XmlDocument that we want to merge from.
        Dim xdFrom As New XmlDocument()
        xdFrom.Load(Application.StartupPath & "XmlTest2.xml")

        ' The XMLDocument that we want to merge to.
        Dim xdTo As New XmlDocument()
        xdTo.Load(Application.StartupPath & "XmlTest.xml")

        ' Loop through all of the nodes in the "from" document.
        ' We don't want to copy the root node in this instance.
        For Each nod As XmlNode In xdFrom.DocumentElement.ChildNodes
            ' Import the node to our "to" document.
            Dim tmpNod As XmlNode = xdTo.ImportNode(nod, True)
            ' Append this temporary node to the end of the "to" document
            ' but inside the root element.
            xdTo.DocumentElement.AppendChild(tmpNod)
        Next nod

        ' Save the "to" document with it's newly appended nodes.
        xdTo.Save(Application.StartupPath & "XmlTest.xml")

visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
AnoPem
VIP - Donator
VIP - Donator
Posts: 441
Joined: Sat Jul 24, 2010 10:55 pm

Dummy1912 wrote:
hello anopm,

no idea if this works i didn't tested it :)
hope this works out for you.
but split it again no idea
why even split it again if you merge them in 1 file :lol:
Thanks seems to work, now i just need a way of doing the opposite
https://t.me/pump_upp
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

cool glad that works
now we wait for someone with the opposite way :lol:
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Well before you append a new file to an existing one, you must write a marker and then the other file, after that you can split the new file by using the marker.
Code: Select all
Old file contents
<split marker>
New file contents
You can find me on Facebook or on Skype mihai_92b
5 posts Page 1 of 1
Return to “Tutorial Requests”