91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

針對xml文件的對于節點的 增刪改查操作實例。代碼寫的有點糙,見諒。

資源截圖

代碼片段和文件信息

using?System;
using?System.Data;
using?System.Configuration;
using?System.Collections;
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.xml;


//51aspx
public?partial?class?Addxml?:?System.Web.UI.Page
{
????protected?void?Page_Load(object?sender?EventArgs?e)
????{

????}
????protected?void?Button1_Click(object?sender?EventArgs?e)
????{
????????//操作四:添加一個節點
????????xmlDocument?xmlDoc?=?new?xmlDocument();
????????xmlDoc.Load(Server.MapPath(“xmlFile/xmlFile.xml“));
????????//創建一個新節點
????????xmlElement?newElement?=?xmlDoc.CreateElement(“poems“);
????????//創建newElement下的節點
????????xmlElement?elid?=?xmlDoc.CreateElement(“id“);
????????xmlElement?elauthor?=?xmlDoc.CreateElement(“author“);
????????xmlElement?eltitle?=?xmlDoc.CreateElement(“title“);
????????xmlElement?elcontent?=?xmlDoc.CreateElement(“content“);
????????elid.InnerText?=?ReturnCount();
????????elauthor.InnerText?=?this.tbaddauthor.Text.Trim();
????????eltitle.InnerText?=?this.tbaddtitle.Text.Trim();
????????elcontent.InnerText?=?this.tbaddcontent.Text.Trim();
????????//將newElement下的節點加到newElement上
????????newElement.AppendChild(elid);
????????newElement.AppendChild(elauthor);
????????newElement.AppendChild(eltitle);
????????newElement.AppendChild(elcontent);
????????//將newElement加入到xml文件中(加在最后一條記錄上)
????????xmlDoc.DocumentElement.AppendChild(newElement);
????????//如果要插到某條記錄之后也可以用(加在第一條記錄之后)
????????//xmlDoc.DocumentElement.InsertAfter(newElementxmlDoc.DocumentElement.ChildNodes.Item(0));
????????//如果要插到某條記錄之前也可以用(加在第一條記錄之前)
????????//xmlDoc.DocumentElement.InsertBefore(newElementxmlDoc.DocumentElement.ChildNodes.Item(0));
????????//存盤
????????xmlDoc.Save(Server.MapPath(“xmlFile/xmlFile.xml“));
????????Response.Redirect(“Default.aspx“);
????}
????public?string?ReturnCount()
????{
????????//返回最后的ID值并+1
????????string?i?=?string.Empty;
????????xmlDocument?xmlDoc?=?new?xmlDocument();
????????xmlDoc.Load(Server.MapPath(“xmlFile/xmlFile.xml“));
????????xmlNode?xmlNode?=?xmlDoc.DocumentElement.LastChild;
????????if?(xmlNode?!=?null)
????????{
????????????i?=?Convert.ToString(Convert.ToUInt32(xmlNode[“id“].InnerText)?+?1);
????????}
????????return?i;
????}
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????879??2010-06-25?09:39??xmllx\Add.aspx

?????文件???????2032??2010-06-25?09:58??xmllx\Add.aspx.cs

?????文件???????1695??2010-06-25?10:06??xmllx\Default.aspx

?????文件????????794??2010-06-25?10:33??xmllx\Default.aspx.cs

?????文件????????434??2010-06-25?08:25??xmllx\del.aspx

?????文件????????947??2010-06-25?10:15??xmllx\del.aspx.cs

?????文件????????692??2010-06-25?08:56??xmllx\DisPlay.aspx

?????文件????????959??2010-06-25?09:12??xmllx\DisPlay.aspx.cs

?????文件????????876??2010-06-25?10:28??xmllx\Edit.aspx

?????文件???????1800??2010-06-25?10:40??xmllx\Edit.aspx.cs

?????文件????????764??2010-06-25?11:40??xmllx\MasterPage.master

?????文件????????417??2010-06-25?11:22??xmllx\MasterPage.master.cs

?????文件????????444??2010-06-25?11:18??xmllx\SetiMarp.aspx

?????文件????????409??2010-06-25?11:18??xmllx\SetiMarp.aspx.cs

?????文件???????1642??2010-06-25?09:06??xmllx\web.config

?????文件????????314??2010-06-25?11:19??xmllx\Web.sitemap

?????文件????????747??2010-06-25?10:37??xmllx\xmlFile\xmlFile.xml

?????文件???????1650??2010-06-24?17:36??xml\Addxml.aspx

?????文件???????2576??2010-06-24?17:36??xml\Addxml.aspx.cs

?????文件???????1236??2010-06-24?17:36??xml\App_Data\xmlFileBak.xml

?????文件???????1881??2010-06-24?17:36??xml\Default.aspx

?????文件????????721??2010-06-25?06:58??xml\Default.aspx.cs

?????文件????????459??2010-06-24?17:36??xml\Delxml.aspx

?????文件???????1259??2010-06-25?07:29??xml\Delxml.aspx.cs

?????文件????????895??2010-06-24?17:36??xml\Editxml.aspx

?????文件???????2496??2010-06-25?07:35??xml\Editxml.aspx.cs

?????文件????????725??2010-06-24?17:36??xml\GetOnexml.aspx

?????文件???????2622??2010-06-25?07:34??xml\GetOnexml.aspx.cs

?????文件???????2638??2010-06-24?17:36??xml\Homexml.aspx

?????文件???????2887??2010-06-24?17:36??xml\Homexml.aspx.cs

............此處省略16個文件信息

評論

共有 條評論