xml文件如图:
<ROOT>
<Info>
<ProjectGuid>E6101000801000132</ProjectGuid>
<ProjectName>西安工程大学文体楼项目</ProjectName>
<Date>2019-04-24 11:06:43</Date>
</Info>
</ROOT>
代码获取:
方法一:
XmlDocument xml = new XmlDocument();
xml.Load(Application.StartupPath + \\Info.xml");
XmlNodeList nodeList = xml.SelectNodes("/ROOT/Info");
foreach (XmlNode item in nodeList)
{
XmlNodeList Lists= item.ChildNodes;
foreach (XmlNode List in Lists)
{
if (List.Name== "ProjectGuid")
{
string str=List.InnerXml;
}
}
}