读写xml文件信息到textbox控件
来源:互联网 发布:安卓答题软件源码 编辑:程序博客网 时间:2024/04/28 19:02
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = true;
xmlDoc.Load(Server.MapPath("xmlfile.xml"));
// return xmlDoc.InnerXml;
txtHtml.Text = xmlDoc.InnerXml;
Sys.xml
<?xml version="1.0" encoding="utf-8" ?>
<Settings>
<ConsumeMoney>300</ConsumeMoney>
</Settings>
///读
public string GetValue()
{
XmlDocument xDoc = new XmlDocument();
//获取可执行文件的路径和名称
xDoc.Load("Sys.xml");
XmlNode xNode;
XmlElement xElem1;
xNode = xDoc.SelectSingleNode("Settings");
xElem1 = (XmlElement)xNode.SelectSingleNode("ConsumeMoney");
if (xElem1 != null)
return xElem1.InnerText;
else
return "";
}
//写
public void SetValue(string AppKey, string AppValue)
{
XmlDocument xDoc = new XmlDocument();
//获取可执行文件的路径和名称
xDoc.Load("Sys.xml");
XmlNode xNode;
XmlElement xElem1;
XmlElement xElem2;
xNode = xDoc.SelectSingleNode("Settings");
xElem1 = (XmlElement)xNode.SelectSingleNode(AppKey);
if (xElem1 != null)
xElem1.InnerText = AppValue;
else
{
xElem2 = xDoc.CreateElement(AppKey);
xElem2.Value = AppValue;
xNode.AppendChild(xElem2);
}
xDoc.Save("Sys.xml");
}
- 读写xml文件信息到textbox控件
- 用文件流的形式读写xml文件到MFC的树控件中
- C#通用类实现 读取xml控制Asp.net控件输入信息长度(TextBox,FileUpload)
- C#通用类实现 读取xml控制Asp.net控件输入信息长度(TextBox,FileUpload)
- xml格式保存信息到文件
- dom4j保存信息到XML文件
- XML文件数据的读写查询[NativeXML控件实现]
- TextBox内容输出到XML中
- 读写XML文件
- 读写XML文件
- c#读写xml文件
- c#读写xml文件
- c#读写xml文件
- DOM 读写XML文件
- 读写XML文件
- C#读写xml文件
- 读写Xml文件
- c#读写xml文件
- 虚拟机 VMware Tools 安装
- int to char
- 存稿箱
- 访问相邻的兄弟节点
- vim显示行号、语法高亮、自动缩进的设置
- 读写xml文件信息到textbox控件
- Elf文件图形详解
- Linux编译声卡驱动
- x264编码的arm移植x264编码的arm移植
- 中断号和芯片中断引脚的关系
- 安第斯山大
- ArrayList和多维数组
- Linux下C++程序常用编译命令
- 二分图匹配(简单题)POJ 1274 The Perfect Stall