data.xml文件如下:
<?xml version="1.0" encoding="gb2312"?>
<Configuration xmlns="http://tempuri.org/Configuration.xsd">
  <Time>2006-2-18 14:18:06</Time>
  <FileInfo>
    <Application>
      <ProductName>LetBetter</ProductName>
      <UserAppDataRegistry>&gt;HKEY_CURRENT_USER\Software\LetBetter\LetBetter\1.0.2240.25713 [0xd50]</UserAppDataRegistry>
      <CompanyName>LetBetter</CompanyName>
      <Language>System.Windows.Forms.InputLanguage</Language>
      <CommonDataPath>C:\Documents and Settings\All Users\Application Data\LetBetter\LetBetter\1.0.2240.25713</CommonDataPath>
      <Ver>1.0.2240.25713</Ver>
      <Path>E:\VS.Net2003\LetBetter\bin\Debug</Path>
    </Application>
    <More>
      <Status>C:\Documents and Settings\cbtegmy\Application Data\LetBetter\LetBetter\1.0.2240.25713</Status>
    </More>
  </FileInfo>
  <server>
    <ServerName>dsj</ServerName>
    <DataBase>custom</DataBase>
    <UserID>sa</UserID>
  </server>
</Configuration>如果我想读取server节点下的数据servername,database,userid的值,并将其值复制到string 类型中的Name,DataBase,UID中,我使用了下面的代码,但是不好时,请赐教:我的代码:
/// <summary>
/// 读取先前的配置文件
/// </summary>
/// <returns></returns>
public bool ReadLoginData()
{

if(System.IO.File.Exists(Application.StartupPath+"\\data.xml")) //判断是否存在data.xml文件
{
try
{
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.Load(Application.StartupPath+"\\data.xml");
XmlNodeList nl=xmlDoc.SelectSingleNode("//Configuration/server").ChildNodes;
????
return true;
}
catch 
{
return false;
}
}
else
{
return false;
}
}