If I have two string of xml1 and xml2 which both represent xml in the same format. What is the fastest way to combine these together? The format is not important, but I ju
In my case the main solution did not work well, the difference was that I had a List for a thousands of files when I take one element and try to merge with the first element I get OutOfMemory exception, I added an empty template with and empty row (NodeA in this case) to solve the weird problem of the memory and run smoothly.
I save the document in other process
XDocument xmlDocTemplate = GetXMLTemplate(); -- create an empty document with the same root and empty row element (NodeA), everything will be merge here.
List lstxElements = GetMyBunchOfXML();
foreach (var xmlElement lstxElements)
{
xmlDocTemplate
.Root
.Descendants("NodeA")
.LastOrDefault()
.AddAfterSelf(xmlElement.Descendants("NodeA"));
}