易截截图软件、单文件、免安装、纯绿色、仅160KB

XML创建新结点

private void CreateNewXmlNode()
{
String strFileName = string.Empty;
strFileName = this.strCurrentPath + "System.xml";
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.Load(strFileName);
XmlNode root = xmlDoc.SelectSingleNode("connect");
XmlElement xe1 = xmlDoc.CreateElement("Data2");
XmlElement xesub1 = xmlDoc.CreateElement("ServerType");
xesub1.InnerText = "SQLSERVER";
xe1.AppendChild(xesub1);
xesub1 = xmlDoc.CreateElement("Server");
xesub1.InnerText = "192.168.0.150";
xe1.AppendChild(xesub1);
xesub1 = xmlDoc.CreateElement("database");
xesub1.InnerText = "VirDinnerOfflineDB";
xe1.AppendChild(xesub1);
xesub1 = xmlDoc.CreateElement("UserID");
xesub1.InnerText = "sa";
xe1.AppendChild(xesub1);
xesub1 = xmlDoc.CreateElement("Password");
xesub1.InnerText = "1234";
xe1.AppendChild(xesub1);
root.AppendChild(xe1);
xmlDoc.Save(strFileName);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
}


相关文档:

XML文档的显示 CSS

Product.xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="product.css" ?>
<productata>
<product prodid="p001" category="toy">
<productname>Mini Bus</productname>
<description>This is a toy for childern aged 4 and above&l ......

xml出错

 XmlDocument xmlDoc = new XmlDocument();
 xmlDoc.Load(@"E:\大二下\xml\province.xml");
会提示出现以下错误
http://hi.csdn.net/attachment/201005/24/0_1274703276Ld6I.gif
麻烦各位帮忙看看,谢谢了 ......

使用XmlDocument类完成对XML的查、删、添、改

使用XmlDocument类完成对XML的查、删、添、改
http://www.aspdiy.net/article/53.htm
后台C#代码
  1using System;
  2using System.Collections;
  3using System.ComponentModel;
  4using System.Data;
  5using System.Drawing;
  6using System. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号