您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->Acom进出仓管理系统源码>>Components/XmlControl.cs>>代码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:Acom进出仓管理系统源码


当前文件路径:AcomStore/Components/XmlControl.cs 文件类型
普通视图
		            
1using System; 2using System.Data; 3using System.Collections.Generic; 4using System.Text; 5using System.Xml; 6using System.IO; 7 8//该源码下载自www.51aspx.com(51aspx.com) 9 10namespace AcomLb.Components 11{ 12 public class XmlControl 13 { 14 protected string strXmlFile; 15 protected XmlDocument objXmlDoc = new XmlDocument(); 16 17 public XmlControl(string XmlFile) 18 { 19 // 20 // TODO: 在这里加入建造函数和程序码 21 // 22 try 23 { 24 objXmlDoc.Load(XmlFile); 25 } 26 catch (System.Exception ex) 27 { 28 throw ex; 29 } 30 strXmlFile = XmlFile; 31 } 32 33 public DataView GetData(string XmlPathNode) 34 { 35 //查找数据,返回一个DataView 36 DataSet ds = new DataSet(); 37 StringReader read = new StringReader(objXmlDoc.SelectSingleNode(XmlPathNode).OuterXml); 38 ds.ReadXml(read); 39 return ds.Tables[0].DefaultView; 40 41 } 42 43 44 public void Replace(string XmlPathNode, string Content) 45 { 46 //更新节点內容。 47 objXmlDoc.SelectSingleNode(XmlPathNode).InnerText = Content; 48 } 49 50 public void Delete(string Node) 51 { 52 //刪除一个节点。 53 string mainNode = Node.Substring(0, Node.LastIndexOf("/")); 54 objXmlDoc.SelectSingleNode(mainNode).RemoveChild(objXmlDoc.SelectSingleNode(Node)); 55 } 56 57 public void InsertNode(string MainNode, string ChildNode, string Element, string Content) 58 { 59 //插入一节点和此节点一个子节点。 60 XmlNode objRootNode = objXmlDoc.SelectSingleNode(MainNode); 61 XmlElement objChildNode = objXmlDoc.CreateElement(ChildNode); 62 objRootNode.AppendChild(objChildNode); 63 XmlElement objElement = objXmlDoc.CreateElement(Element); 64 objElement.InnerText = Content; 65 objChildNode.AppendChild(objElement); 66 } 67 68 public void InsertElement(string MainNode, string Element, string Attrib, string AttribContent, string Content) 69 { 70 //插入一节点,带一属性。 71 XmlNode objNode = objXmlDoc.SelectSingleNode(MainNode); 72 XmlElement objElement = objXmlDoc.CreateElement(Element); 73 objElement.SetAttribute(Attrib, AttribContent); 74 objElement.InnerText = Content; 75 objNode.AppendChild(objElement); 76 } 77 78 public void InsertElement(string MainNode, string Element, string Content) 79 { 80 //插入一节点,不带属性。 81 XmlNode objNode = objXmlDoc.SelectSingleNode(MainNode); 82 XmlElement objElement = objXmlDoc.CreateElement(Element); 83 objElement.InnerText = Content; 84 objNode.AppendChild(objElement); 85 } 86 87 public void Save() 88 { 89 //保存文档。 90 try 91 { 92 objXmlDoc.Save(strXmlFile); 93 } 94 catch (System.Exception ex) 95 { 96 throw ex; 97 } 98 objXmlDoc = null; 99 } 100 } 101} 102
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Acom进出仓管理系统源码

- WO@BIZ第一季1.2版源码

- XML同学录系统源码(毕业设计)

- 简单的验证码实例(全部源代..

- EduMis信息发布系统源码

- 某学院计算机系网站初稿(页面..

- 新闻发布系统源码及演示PPT

- BugTrack51aspx汉化改造版V2.1.7

- Asp.net2.0开发的网上图书销..

51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号