- public static ListCLocalTabStruct.ScreenLableItem> GetXmlLabelNameList(string fileFullName)
- {
- ListCLocalTabStruct.ScreenLableItem> listLabelItem = new ListCLocalTabStruct.ScreenLableItem>();
- if (fileFullName.Equals(string.Empty))
- return null;
-
- XmlDocument tmpDoc = new XmlDocument();
- tmpDoc.Load(fileFullName);
- XmlNode rootNode = tmpDoc.SelectSingleNode("Controls");
-
- XmlNodeList slblNodeList = null;
- if (rootNode.SelectSingleNode("SmartLabels") != null)
- slblNodeList = rootNode.SelectSingleNode("SmartLabels").ChildNodes;
-
- if (slblNodeList == null)
- return null;
-
- foreach (XmlNode xn0 in slblNodeList)
- {
- XmlElement xe = (XmlElement)xn0;
- CLocalTabStruct.ScreenLableItem lblItem = new CLocalTabStruct.ScreenLableItem();
- lblItem.ItemName = xe.GetAttribute("Name");
- lblItem.Text = xe.GetAttribute("Text");
-
- listLabelItem.Add(lblItem);
- }
- listLabelItem.Sort(CompareObject);
-
- return listLabelItem;
- }
-
- public static int CompareObject(CLocalTabStruct.ScreenLableItem x, CLocalTabStruct.ScreenLableItem y)
- {
- int result = 0;
- result = y.ItemName.CompareTo(x.ItemName);
- return result;
- }
http://blog.csdn.net/zhouqinghe24/article/details/8649521