|
沙发

楼主 |
发表于 2021-4-8 23:46:02
|
只看该作者
- using System;
- using System.Collections;
- using System.Windows.Forms;
- using System.Xml;
- namespace SFSCFCS
- {
- public class FCSet
- {
- private Hashtable htFCS = null;
- private XmlDocument xmlDoc = null;
- public FCSet(string strxmlfile)
- {
- try
- {
- htFCS = new Hashtable();
- xmlDoc = new XmlDocument();
- xmlDoc.Load(strxmlfile);
- }
- catch (Exception ex)
- {
- MessageBox.Show("Read xml file Err\n" + ex.ToString(), "xmlFileRead", MessageBoxButtons.OK, MessageBoxIcon.Hand);
- }
- }
- public void Dispose()
- {
- if (htFCS != null)
- {
- htFCS.Clear();
- htFCS = null;
- }
- if (xmlDoc != null)
- {
- xmlDoc = null;
- }
- }
- public Hashtable GetFCSet(string strProcessNo)
- {
- try
- {
- XmlNode xmlNode = xmlDoc.SelectSingleNode(strProcessNo);
- if (xmlNode != null)
- {
- XmlNodeList childNodes = xmlNode.ChildNodes;
- if (childNodes != null)
- {
- foreach (XmlNode item in childNodes)
- {
- htFCS.Add(item.InnerText, item.Name);
- }
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("Read XML node Err\n" + ex.ToString(), "xmlFileRead", MessageBoxButtons.OK, MessageBoxIcon.Hand);
- }
- return htFCS;
- }
- }
- }
复制代码
|
|