I'm doing a MVC application where several Xml-files will be used (Every XML-file has the same nodes and DTD). I'm wondering if it is possible to use the .Load-method to load a list containing strings of XML-files?
If not, is there any other solution for loading several Xml-files at the same time?
you can first load all the XML files from a folder and then create a list of xmldocuments from the file list:
var filePathsList = Directory.GetFiles(@"C:\temp", "*.xml");
var xmlDocuments = new List<XmlDocument>(filePathsList.Count());
foreach (var filePath in filePathsList)
{
var xmlDoc = new XmlDocument();
xmlDoc.Load(filePath);
xmlDocuments.Add(xmlDoc);
}
You will then have the xmlDocuments list filled with your XMLs.