I am trying to get file locations out of an XML file rather than hard coding locations that could ultimately change.
I don't know how many files there will be which is causing me issue.
How can I get this function to iterate through all nodes and copy them to a new index within the array?
update
Is there a way to do this using arrays if you don't know the size, perhaps an ArrayList for example or chuck it into a list and convert to an array after? Whichever method would be best.
Below is the code I've written so far:
public static void LoadMyXML()
{
string xmlfp = _AppPath + @"\Config";
try
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(xmlfp);
XmlNode xmlLst = xDoc.SelectSingleNode("parent1/child1");
string[] xmlNodeArray;
foreach (XmlNode node in xmlLst.ChildNodes)
{
//read through and add any child nodes to the array
xmlNodeArray[] = node.InnerText;
}
}
catch(Exception ex)
{
WriteErrorToLog("XML Loading error " + ex.ToString());
}
}