惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog
Y
Y Combinator Blog
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位
The Cloudflare Blog
T
The Blog of Author Tim Ferriss
博客园_首页
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
宝玉的分享
宝玉的分享

博客园 - 雨人(ralpher)

volatile VS synchronized 记录一个小问题:游标中声明排序的写法问题 Great feature for Sql 2005--Row_number()分页 Recommend a site. 推荐一文:程序员的灯下黑:坚持和良好心态近乎道 EnglishTalk----Too Much Test Automation? 我这几年-----对于初学者的几点建议 面向对象设计原则(转) 系分考试论文实例12篇 一道禅语 好久没来了 First trip to BeiJing 飘到北京了 体验Castle中从配置文件注册组件以及传递参数的一个小例子 IOC模式的学习笔记 IBatisNet之运行时多数据库切换方案 在IBatisNet中使用存储过程 装箱 与 虚方法分发 IBatisNet初步体验
读写xml配置文件
雨人(ralpher) · 2005-12-23 · via 博客园 - 雨人(ralpher)

用程序来读写xml文件的内容,对于节点的内容是区分大小写的。
配置文件如下:
*****************providers.config***************
<?xml version="1.0" encoding="utf-8"?>
<settings>
  <add key="provider" value="sqlServer1.1" />
  <add key="connectionString" value="data source=(local);database=Npetshop;user id=sa;password=;connection

reset=false;connection lifetime=5; min pool size=1; max pool size=50" />
  <add key="root" value="./" />
</settings>

********************************

读写文件的代码程序如下:
**********************************************************
 XmlDocument xml = new XmlDocument();
   xml.Load(XML_FILE_NAME);
   XmlElement ele =

(XmlElement)xml.SelectSingleNode("settings/add[@key='connectionString']");
   ele.SetAttribute("value",connStr);
   xml.Save(XML_FILE_NAME);
*************************************
开始将SelectSingleNode参数内容中的"settings"写成"Settings"了,结果老是提示“对象未引用”,
最后将xml节点中的内容大小写改一致后才可以,搞了半个小时才搞明白,惭愧...