Hi,
I have written a bunch of "Shared Settings" out to an .xml file and I'm trying to read them back, however I'm only getting the first email address and enabled setting. The XML looks like this:
<SharedSettings>
<eMail>
<eMailAddress>gm111@verizon.net</eMailAddress>
<eMailAddress>dq222@verizon.net</eMailAddress>
<eMailAddress>fred333@verizon.net</eMailAddress>
<eMailAddress/>
<eMailAddress/>
<eMailAddress/>
<eMailAddress/>
<eMailAddress/>
<eMailAddress/>
<eMailAddress/>
<eMailEnabled>True</eMailEnabled>
<eMailEnabled>False</eMailEnabled>
<eMailEnabled>False</eMailEnabled>
<eMailEnabled>False</eMailEnabled>
<eMailEnabled>False</eMailEnabled>
<eMailEnabled>False</eMailEnabled>
<eMailEnabled>False</eMailEnabled>
<eMailEnabled>False</eMailEnabled>
<eMailEnabled>False</eMailEnabled>
<eMailEnabled>False</eMailEnabled>
</eMail>
</SharedSettings>
and the code I'm using to read the settings looks like this:
xmlDoc = new XmlDocument();
xmlDoc.Load(@GetSet.path + @"\SharedSettings.xml");
XmlNodeList xnList = xmlDoc.SelectNodes("/SharedSettings/eMail");
x = 1;
foreach (XmlNode xn in xnList)
{
string eMailAddress[x] = xn["eMailAddress"].InnerText;
bool bEmail[x] = Convert.ToBoolean(xn["eMailEnabled"].InnerText);
x++;
}
Looking at the Count in "xn" it shows as one. I'm new to XML and don't see what I've done wrong. Is the XML wrong or am I reading it wrong? Do you have an example of how to do this?
Thank you,
Glenn