asp.net 操作xml
asp.net 对xml文件的读写,添加,修改,删除操作
下面有代码调试正确
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
private XmlDocument xmlDoc;
//load xml file
private void LoadXml()
{
xmlDoc=new XmlDocument();
xmlDoc.Load(Server.MapPath("User.xml"));
}
//添加节点
private void AddElement()
{
LoadXml();
XmlNode xmldocSelect=xmlDoc.SelectSingleNode("user");
XmlElement el=xmlDoc.CreateElement("person"); //添加person节点
el.SetAttribute("name","风云"); //添加person节点的属性"name"
el.SetAttribute("sex","女"); //添加person节点的属性 "sex"
el.SetAttribute("ag
相关文档:
我们在首次部署mvc的项目时通常会遇到一点问题。M$已经在Global.asax.cs文件中包含了这两句注释的提示。
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
但是我们访问这个网址看到上面的文章对iis5.1(win ......
String.IndexOf 方法 (value, [startIndex], [count])
报告指定字符在此实例中的第一个匹配项的索引。搜索从指定字符位置开始,并检查指定数量的字符位置。
参数
value
要查找的 Unicode 字符。 对 value 的搜索区分大小写。
startIndex(Int32)
可选项,搜索起始位置。不设置则从0开始。
......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;
using System.Text; ......
系统类
Type类,Object类,String类, Array类,Console类, Exception类,GC类, MarshalByRefObject类, Math类。
DateTime结构,Guid 结构,
ICloneable接口,IComparable接口,IConvertible接口, IDisposable类,
集合类
ICollection接口,IComparer接口,IDictionary接口。IDictionaryEnume ......