I have a small app that saves and loads data in XML format. Basically I have 2 methods. They each load data from a different XML documents. They both load data the same way. Everything works great except if I call method 1, then method 2, then method 1 again. When I call method 1 the second time, and the XmlDocument is loaded, it is missing a whole level of nodes. I put a break point on the XmlDocument right after the xmlDoc.Load() is called, and its not showing all the nodes that are in the document.
Expand|Select|Wrap|Line Numbers
- private void MethodOne()
- {
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.Load("AllSongs.xml");
- XmlNodeList songs = xmlDoc.SelectNodes("Songs/Song");
- foreach (XmlNode node in songs)
- {
- // create Song object and add to ArrayList
- }
- //Display ArrayList of Songs
- }
Any ideas?
Thanks