您的位置:首页 > 其它

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

2006-11-04 19:15 417 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
3<HTML>
4 <HEAD>
5 <title>xdoc</title>
6 <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
7 <meta content="C#" name="CODE_LANGUAGE">
8 <meta content="JavaScript" name="vs_defaultClientScript">
9 <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
10 </HEAD>
11 <body MS_POSITIONING="GridLayout">
12 <form id="Form1" method="post" runat="server">
13 <FONT face="宋体">
14 <asp:datagrid id="dg" style="Z-INDEX: 101; LEFT: 48px; POSITION: absolute; TOP: 56px" runat="server"
15 ForeColor="Black" BorderStyle="None" BorderWidth="1px" BorderColor="#DEDFDE" BackColor="White"
16 CellPadding="4" GridLines="Vertical" AutoGenerateColumns="False" Width="432px">
17 <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#CE5D5A"></SelectedItemStyle>
18 <AlternatingItemStyle BackColor="White"></AlternatingItemStyle>
19 <ItemStyle BackColor="#F7F7DE"></ItemStyle>
20 <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#6B696B"></HeaderStyle>
21 <FooterStyle BackColor="#CCCC99"></FooterStyle>
22 <Columns>
23 <asp:BoundColumn DataField="name" HeaderText="名字"></asp:BoundColumn>
24 <asp:BoundColumn DataField="City" HeaderText="城市"></asp:BoundColumn>
25 <asp:BoundColumn DataField="Email" HeaderText="邮件地址"></asp:BoundColumn>
26 <asp:BoundColumn DataField="Time" HeaderText="时间"></asp:BoundColumn>
27 </Columns>
28 <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#F7F7DE" Mode="NumericPages"></PagerStyle>
29 </asp:datagrid><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 112px; POSITION: absolute; TOP: 8px" runat="server"
30 Width="336px" BorderWidth="2px" BorderStyle="Ridge" Font-Size="X-Large" Font-Bold="True" ForeColor="Red">XmlDocument类的挖掘</asp:label><asp:dropdownlist id="ddl" style="Z-INDEX: 103; LEFT: 128px; POSITION: absolute; TOP: 280px" runat="server"></asp:dropdownlist><asp:label id="Label2" style="Z-INDEX: 104; LEFT: 64px; POSITION: absolute; TOP: 280px" runat="server">姓名:</asp:label><asp:button id="Button1" style="Z-INDEX: 105; LEFT: 64px; POSITION: absolute; TOP: 328px" runat="server"
31 Width="64px" Text="查询"></asp:button><asp:label id="Label3" style="Z-INDEX: 106; LEFT: 64px; POSITION: absolute; TOP: 384px" runat="server">邮件地址:</asp:label><asp:button id="Button2" style="Z-INDEX: 107; LEFT: 152px; POSITION: absolute; TOP: 328px" runat="server"
32 Width="64px" Text="删除"></asp:button><asp:button id="Button3" style="Z-INDEX: 108; LEFT: 432px; POSITION: absolute; TOP: 280px" runat="server"
33 Width="56px" Text="添加" Height="80px"></asp:button><asp:textbox id="tbn" style="Z-INDEX: 109; LEFT: 152px; POSITION: absolute; TOP: 384px" runat="server"
34 Width="328px"></asp:textbox><asp:button id="Button4" style="Z-INDEX: 110; LEFT: 64px; POSITION: absolute; TOP: 416px" runat="server"
35 Width="424px" Text="修改邮件地址"></asp:button>
36 <asp:TextBox id="tbna" style="Z-INDEX: 111; LEFT: 312px; POSITION: absolute; TOP: 280px" runat="server"
37 Width="104px"></asp:TextBox>
38 <asp:TextBox id="tbc" style="Z-INDEX: 112; LEFT: 312px; POSITION: absolute; TOP: 312px" runat="server"
39 Width="104px" Height="24px"></asp:TextBox>
40 <asp:TextBox id="tbe" style="Z-INDEX: 113; LEFT: 312px; POSITION: absolute; TOP: 344px" runat="server"
41 Width="104px" Height="24px"></asp:TextBox>
42 <asp:Label id="Label4" style="Z-INDEX: 114; LEFT: 264px; POSITION: absolute; TOP: 280px" runat="server">姓名:</asp:Label>
43 <asp:Label id="Label5" style="Z-INDEX: 115; LEFT: 264px; POSITION: absolute; TOP: 312px" runat="server">城市:</asp:Label>
44 <asp:Label id="Label6" style="Z-INDEX: 116; LEFT: 264px; POSITION: absolute; TOP: 344px" runat="server">Email:</asp:Label></FONT></form>
45 </body>
46</HTML>
47

using System;
2using System.Collections;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Web;
7using System.Web.SessionState;
8using System.Web.UI;
9using System.Web.UI.WebControls;
10using System.Web.UI.HtmlControls;
11//新引入两个命名空间
12using System.Xml;
13using System.Xml.XPath;
14
15namespace XML
16

<?xml version="1.0" encoding="utf-8"?>
2<dbGuest>
3 <User>
4 <Name>天轰穿</Name>
5 <City>江油</City>
6 <Email>7665@fds.com</Email>
7 <Time>2006-5-6 16:10:56</Time>
8 </User>
9 <User>
10 <Name>田洪川</Name>
11 <City>绵阳</City>
12 <Email>th@DFs.com</Email>
13 <Time>2006-5-6 16:06:51</Time>
14 </User>
15 <User>
16 <Name>黄小梅</Name>
17 <City>南充</City>
18 <Email>5543@ds.com</Email>
19 <Time>2006-5-6 16:07:15</Time>
20 </User>
21</dbGuest>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: