Chinaunix首页 | 论坛 | 博客
  • 博客访问: 12299035
  • 博文数量: 1293
  • 博客积分: 13501
  • 博客等级: 上将
  • 技术积分: 17974
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-08 18:11
文章分类

全部博文(1293)

文章存档

2019年(1)

2018年(1)

2016年(118)

2015年(257)

2014年(128)

2013年(222)

2012年(229)

2011年(337)

分类: C#/.net

2016-06-20 15:15:09


  1. public static List<CLocalTabStruct.ScreenLableItem> GetXmlLabelNameList(string fileFullName)
  2.         {
  3.             List<CLocalTabStruct.ScreenLableItem> listLabelItem = new List<CLocalTabStruct.ScreenLableItem>();
  4.             if (fileFullName.Equals(string.Empty))
  5.                 return null;

  6.             XmlDocument tmpDoc = new XmlDocument();
  7.             tmpDoc.Load(fileFullName);
  8.             XmlNode rootNode = tmpDoc.SelectSingleNode("Controls");

  9.             XmlNodeList slblNodeList = null;
  10.             if (rootNode.SelectSingleNode("SmartLabels") != null)
  11.                 slblNodeList = rootNode.SelectSingleNode("SmartLabels").ChildNodes;

  12.             if (slblNodeList == null)
  13.                 return null;

  14.             foreach (XmlNode xn0 in slblNodeList)
  15.             {
  16.                 XmlElement xe = (XmlElement)xn0;
  17.                 CLocalTabStruct.ScreenLableItem lblItem = new CLocalTabStruct.ScreenLableItem();
  18.                 lblItem.ItemName = xe.GetAttribute("Name");
  19.                 lblItem.Text = xe.GetAttribute("Text");

  20.                 listLabelItem.Add(lblItem);
  21.             }
  22.             listLabelItem.Sort(CompareObject);

  23.             return listLabelItem;
  24.         }

  25.         public static int CompareObject(CLocalTabStruct.ScreenLableItem x, CLocalTabStruct.ScreenLableItem y)
  26.         {
  27.             int result = 0;
  28.             result = y.ItemName.CompareTo(x.ItemName);
  29.             return result;
  30.         }
参考文献:
http://blog.csdn.net/zhouqinghe24/article/details/8649521
阅读(2332) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~