后台:

写入节点

public static void Update(string path, string node, string attribute, string value)
{
try
{
XmlDocument doc = new XmlDocument();
doc.Load(path);
XmlNode xn = doc.SelectSingleNode(node);
XmlElement xe = (XmlElement)xn;
if (attribute.Equals(""))
xe.InnerText = value;
else
xe.SetAttribute(attribute, value);
doc.Save(path);
}
catch { }
}

Update(patch, "/config/string[@id='id']", "value",TextID.Text.Trim());//更新节点(写入数据)

读取节点

public static string Read(string path, string node, string attribute,string htm)
{
string value = "";
try
{
XmlDocument doc = new XmlDocument();
doc.Load(path);
XmlNode xn = doc.SelectSingleNode(node);
value = (attribute.Equals("") ? (string.IsNullOrEmpty(htm) ? xn.InnerText : xn.InnerXml) : xn.Attributes[attribute].Value);
}
catch { }
return value;
}

CommonForNate.XmlHelper.Read(patch, "/config/string[@id='id']", "value");//取节点数据

xml 充当简易数据库的更多相关文章

  1. java+反射+多线程+生产者消费者模式+读取xml(SAX)入数据库mysql-【费元星Q9715234】

    java+反射+多线程+生产者消费者模式+读取xml(SAX)入数据库mysql-[费元星Q9715234] 说明如下,不懂的问题直接我[费元星Q9715234] 1.反射的意义在于不将xml tag ...

  2. 使用XStream解析复杂XML并插入数据库(二)

    标注黄色地方:我需要加深学习!!! 我写的是webservice,目前具体写webservice的步骤我还不清楚, 整理完小知识开始整理webservice! 针对以下格式的XML进行解析 <? ...

  3. 【DRP】採用dom4j完毕XML文件导入数据库

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/lantingxv_jing/article/details/37762523     xml文件在如 ...

  4. python3.4.3 调用http接口 解析response xml后插入数据库

    工作中需要调用一个http的接口,等不及java组开发,就试着用python去调用.Python版本3.4.3 完整的流程包括:从sqlServer取待调用的合同列表 -> 循环调用http接口 ...

  5. Android通过xml文件配置数据库

    之前一段时间自己封装了两个数据库,一个是ORM数据库,另一个是事件流数据库,项目相应的地址如下: ORM数据库:https://github.com/wenjiang/SimpleAndroidORM ...

  6. 如何将XML文件写入数据库

    将xml文件转成string public string XMLDocumentToString(XmlDocument doc) { MemoryStream stream = new Memory ...

  7. SpringBoot填坑系列---XML方式配置数据库

    本次只是简单的运用SpringBoot搭建框架,对其原理并不做深入的探究 1.POM文件 <?xml version="1.0" encoding="UTF-8&q ...

  8. 使用XStream解析复杂XML并插入数据库(一)

    环境: Springboot+mysql 我只想说jpa真的超级好用,准备深入研究一下~ 导入依赖: <dependency> <groupId>org.projectlomb ...

  9. SpringMVC之application-context.xml,了解数据库相关配置

    上一篇SpringMVC之web.xml让我们了解到配置一个web项目的时候,怎样做基础的DispatcherServlet相关配置.作为SpringMVC上手的第一步.而application-co ...

随机推荐

  1. poj 1141 Brackets Sequence(区间DP)

    题目:http://poj.org/problem?id=1141 转载:http://blog.csdn.net/lijiecsu/article/details/7589877 定义合法的括号序列 ...

  2. 20.org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

    org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actua ...

  3. Hibernate get 和load的区别

    1 load是要用的时候才从数据库去查询,get 是马上查询. 2 对于不存在的记录,get会报空指针异常,load会报 org.hibernate.ObjectNotFoundException:  ...

  4. linux 磁盘空间扩容 vg(+pv) lv(+空间) lv(缩减磁盘空间)

    preFace APP scenario description: 当你未能合理的规划存储时,在后期的维护工作中可能会涉及的存储的 再规划(eg,某一个 or 数个App 对某一个lv 即挂载点写Bi ...

  5. .net网站开发(前端):4.MVC HtmlHelper

    通过前面三节,已经大概理解MVC是怎样运作的了.MVC的一个特点就是可以很方便地控制视图效果,数据交互也很灵活.先讲一下视图控制的,HtmlHelper,看到Help就知道它是不知疲惫的好人啦(有点像 ...

  6. Nginx+Tomcat7+Mencached负载均衡集群部署笔记

    Nginx+Tomcat+Memcached负载均衡集群服务搭建 操作系统:CentOS6.5 本文档主要解说,怎样在CentOS6.5下搭建Nginx+Tomcat+Memcached负载均衡集群s ...

  7. android部分控件应用解析

    java中的接口回调机制图解 1. Adapter 接口概述   Adapter是一个顶层列表视图和底层数据的桥梁,通过adapter可以获取列表视图中所体现的数据条目,并且通过adapter可以为数 ...

  8. 什么是CTS、CLS和CLR

    CTS.CLS和CLR是.NET框架的基本概念,但往往成为程序员们忽视的部分.清楚理解三者的概念,有助于.NET程序员编写高效安全的.NET程序. 所涉及到的知识点 •   .NET的基本概念 •   ...

  9. [转]spring 监听器 IntrospectorCleanupListener简介

    "在服务器运行过程中,Spring不停的运行的计划任务和OpenSessionInViewFilter,使得Tomcat反复加载对象而产生框架并用时可能产生的内存泄漏,则使用Introspe ...

  10. fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

    xxxxxx.lib(xxxxxx.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machin ...