c#脚本中xml和hashtable联系起来

上一篇 / 下一篇  2014-06-26 18:17:53 / 个人分类:selenium

           string XmlPath = Path.Combine("Data", "CaseData", "case1.xml");
            XmlDocument xmlDoc = new XmlDocument();
            Hashtable CaseData = new Hashtable();
            XmlReader reader = XmlReader.Create(XmlPath, new XmlReaderSettings
            {
                IgnoreComments = true
            });
            xmlDoc.Load(reader);
            XmlNode xmlno = xmlDoc.GetElementsByTagName("TestCase")[0];
            foreach (System.Xml.XmlNode xmlvalno in xmlno.ChildNodes)
            {
               CaseData.Add(xmlvalno.Attributes["Key"].Value.ToString(), xmlvalno.Attributes["Value"].Value.ToString());
            }

TAG:

 

评分:0

我来说两句

日历

« 2024-04-29  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 29332
  • 日志数: 27
  • 建立时间: 2014-03-18
  • 更新时间: 2014-07-10

RSS订阅

Open Toolbar