我有一个名为BackupManager.xml
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<Settings>
<directory id="backUpPath" value="D:/BACKUPS/"></directory>
<filename id="feilname" value="SameName"></filename>
<period id ="period" value="15"></period>
</Settings>
</configuration>
我正在尝试从标签中获取值到字符串例如:-我需要将“backUpPath”标签的值作为“D:/BACKUPS/”到字符串说“str”
我试过的代码是
XmlDocument infodoc = new XmlDocument();
infodoc.Load("BackupManager.xml");
//int col = infodoc.GetElementsByTagName("directory").Count;
String str = infodoc.GetElementByID("directory").value;
但我在'str'上得到空值