文档详情

关于C#XML类的使用方法.doc

发布:2017-11-22约1.44万字共11页下载文档
文本预览下载声明
using System; using System.Xml; using System.Web; /// summary /// 必需用XPATH表达式来获取相应节点 /// 关于xpath可以参见: /// /summary public class MyXml { #region 变量 /// summary /// xml文件所在路径类型 /// /summary /// remarksxml文件所在路径类型/remarks public enum enumXmlPathType { /// summary /// 绝对路径 /// /summary AbsolutePath, /// summary /// 虚拟路径 /// /summary VirtualPath } private string xmlFilePath; private enumXmlPathType xmlFilePathType; private XmlDocument xmlDoc = new XmlDocument(); #endregion #region 属性 /// summary /// 文件路径 /// /summary /// remarks文件路径/remarks public string XmlFilePath { get { return this.xmlFilePath; } set { xmlFilePath = value; } } /// summary /// 文件路径类型 /// /summary public enumXmlPathType XmlFilePathTyp { set { xmlFilePathType = value; } } #endregion #region 构造函数 /// summary /// /// /summary /// param name=tempXmlFilePath/param public MyXml(string tempXmlFilePath) { // // TODO: 在此处添加构造函数逻辑 // this.xmlFilePathType = enumXmlPathType.VirtualPath; this.xmlFilePath = tempXmlFilePath; GetXmlDocument(); //xmlDoc.Load( xmlFilePath ) ; } /// summary /// 构造函数 /// /summary /// param name=tempXmlFilePath文件路径/param /// param name=tempXmlFilePathType类型/param public MyXml(string tempXmlFilePath, enumXmlPathType tempXmlFilePathType) { // // TODO: 在此处添加构造函数逻辑 // this.xmlFilePathType = tempXmlFilePathType; this.xmlFilePath = tempXmlFilePath; GetXmlDocument(); } #endregion ///summary ///获取XmlDocument实体类 ////summary /// returns指定的XML描述文件的一个xmldocument实例/returns private XmlDocument GetXmlDocument() { XmlDocument
显示全部
相似文档