是否可以通过读取C#代码来准确地确定XML文件的结构。
代码:
XmlDocument xDoc = new XmlDocument();
xDoc.Load(AppDomain.CurrentDomain.BaseDirectory + "\\Contacts.xml");
XmlNodeList nodeList = xDoc.SelectNodes("/ContactsList/Group[@Name='" + group_name + "']");
if (nodeList[0].ChildNodes[2].InnerText != "NA")
{
if ((now < start) || (now > end))
{
primary_number = nodeList[0].ChildNodes[2].InnerText;
}
else
primary_number = nodeList[0].ChildNodes[0].InnerText;
}
else
primary_number = nodeList[0].ChildNodes[0].InnerText;
if (nodeList[0].ChildNodes[3].InnerText != "NA")
{
if ((now < start) || (now > end))
{
secondary_number = nodeList[0].ChildNodes[3].InnerText;
}
else
secondary_number = nodeList[0].ChildNodes[1].InnerText;
}
else
secondary_number = nodeList[0].ChildNodes[1].InnerText;
}
我无法找到xml文件,我正在尝试重现Contacts.xml文件的结构。