从配置文件xml中读取需要更新的表名
2012-07-28 11:19
429 查看
ArrayList al = new ArrayList(); try { XmlDocument xmlDoc = new XmlDocument(); string xmlPath = Application.StartupPath + "\\Config\\UpdateDataTable.xml"; XmlDocument xmlDoc1 = new XmlDocument(); xmlDoc.Load(xmlPath); XmlNode rootNode = xmlDoc.SelectSingleNode("LoadTable"); XmlNodeList firstLevelNodeList = rootNode.ChildNodes; foreach (XmlNode node in firstLevelNodeList) { XmlElement xe = (XmlElement)node; if (xe.GetAttribute("Name").ToString() != " " && xe.GetAttribute("IsStart").ToString() == "是") { al.Add(xe.GetAttribute("Name").ToString()); } } } catch { this.timer1.Enabled = false; MessageBox.Show("读取配置文件出错!"); this.Dispose(); this.Close(); }
配置文件如下:
<?xml version="1.0" encoding="GB2312"?> <LoadTable> <DataTable Name="PROCESS_STAFFONLINERECORD" IsStart="否" Tag="0"> </DataTable> <DataTable Name="STATIONLIST" IsStart="是" Tag="0"> </DataTable> <DataTable Name="STATIONDEVICE" IsStart="否" Tag="0"> </DataTable> </LoadTable>
相关文章推荐
- 读取jar包内外配置文件,xml property文件的读取修改
- XML配置文件的读取与修改
- 读取xml文件中的配置参数
- java读取配置文件xml
- INI的替代品--XML配置文件读取与保存
- Unity3d中有关配置表(文件)采用XML和String方法的读取和写入
- 关于j2ee工程发布到was上后,部分更新,例修改web.xml配置文件不起作用的原因解析
- java xml配合实现读取配置文件登陆
- SSH读取applicationContext.xml配置文件测试hibernate方法
- JDOM读取XML配置文件--单例模式
- Spring中c3p0连接池的配置 及JdbcTemplate的使用 通过XML配置文件注入各种需要对象的操作 来完成数据库添加Add()方法
- 关于spring MVC web.xml配置文件的编写总结(持续更新)
- struts2.x + Tiles2.x读取多个xml 配置文件
- Servlet(19)web.xml 配置之Servlet参数配置和读取资源文件,获取文件全路径
- java读取xml/.properties配置文件
- spring xml配置文件中指定的xsd文件读取不到了org.xml.sax.SAXParseException:
- XML配置文件的读取处理(转)
- 读取applicationContext.xml(spring配置文件)文件
- Sqlserver:从XML文件中读取配置信息