1
在C#.net中如何操作XML
2
需要添加的命名空间:
3
using System.Xml;
4
5
定义几个公共对象:
6
XmlDocument xmldoc ;
7
XmlNode xmlnode ;
8
XmlElement xmlelem ;
9
10
1,创建到服务器同名目录下的xml文件:
11
12
13
方法一:
14
xmldoc = new XmlDocument ( ) ;
15
//加入XML的声明段落
16
xmlnode = xmldoc.CreateNode ( XmlNodeType.XmlDeclaration , "" , "" ) ;
17
xmldoc.AppendChild ( xmlnode ) ;
18
//加入一个根元素
19
xmlelem = xmldoc.CreateElement ( "" , "Employees" , "" ) ;
20
xmldoc.AppendChild ( xmlelem ) ;
21
//加入另外一个元素
22
for(int i=1;i<3;i++)
23
{
24
25
XmlNode root=xmldoc.SelectSingleNode("Employees");//查找<Employees>
26
XmlElement xe1=xmldoc.CreateElement("Node");//创建一个<Node>节点
27
xe1.SetAttribute("genre","李赞红");//设置该节点genre属性
28
xe1.SetAttribute("ISBN","2-3631-4");//设置该节点ISBN属性
29
30
XmlElement xesub1=xmldoc.CreateElement("title");
31
xesub1.InnerText="CS从入门到精通";//设置文本节点
32
xe1.AppendChild(xesub1);//添加到<Node>节点中
33
XmlElement xesub2=xmldoc.CreateElement("author");
34
xesub2.InnerText="候捷";
35
xe1.AppendChild(xesub2);
36
XmlElement xesub3=xmldoc.CreateElement("price");
37
xesub3.InnerText="58.3";
38
xe1.AppendChild(xesub3);
39
40
root.AppendChild(xe1);//添加到<Employees>节点中
41
}
42
//保存创建好的XML文档
43
xmldoc.Save ( Server.MapPath("data.xml") ) ;
44
45
//////////////////////////////////////////////////////////////////////////////////////
46
结果:在同名目录下生成了名为data.xml的文件,内容如下,
47
<?xml version="1.0"?>
48
<Employees>
49
<Node genre="李赞红" ISBN="2-3631-4">
50
<title>CS从入门到精通</title>
51
<author>候捷</author>
52
<price>58.3</price>
53
</Node>
54
<Node genre="李赞红" ISBN="2-3631-4">
55
<title>CS从入门到精通</title>
56
<author>候捷</author>
57
<price>58.3</price>
58
</Node>
59
</Employees>
60
61
62
方法二:
63
XmlTextWriter xmlWriter;
64
string strFilename = Server.MapPath("data1.xml") ;
65
66
xmlWriter = new XmlTextWriter(strFilename,Encoding.Default);//创建一个xml文档
67
xmlWriter.Formatting = Formatting.Indented;
68
xmlWriter.WriteStartDocument();
69
xmlWriter.WriteStartElement("Employees");
70
71
xmlWriter.WriteStartElement("Node");
72
xmlWriter.WriteAttributeString("genre","李赞红");
73
xmlWriter.WriteAttributeString("ISBN","2-3631-4");
74
75
xmlWriter.WriteStartElement("title");
76
xmlWriter.WriteString("CS从入门到精通");
77
xmlWriter.WriteEndElement();
78
79
xmlWriter.WriteStartElement("author");
80
xmlWriter.WriteString("候捷");
81
xmlWriter.WriteEndElement();
82
83
xmlWriter.WriteStartElement("price");
84
xmlWriter.WriteString("58.3");
85
xmlWriter.WriteEndElement();
86
87
xmlWriter.WriteEndElement();
88
89
xmlWriter.Close();
90
//////////////////////////////////////////////////////////////////////////////////////
91
结果:
92
<?xml version="1.0" encoding="gb2312"?>
93
<Employees>
94
<Node genre="李赞红" ISBN="2-3631-4">
95
<title>CS从入门到精通</title>
96
<author>候捷</author>
97
<price>58.3</price>
98
</Node>
99
</Employees>
100
101
2,添加一个结点:
102
103
XmlDocument xmlDoc=new XmlDocument();
104
xmlDoc.Load(Server.MapPath("data.xml"));
105
XmlNode root=xmlDoc.SelectSingleNode("Employees");//查找<Employees>
106
XmlElement xe1=xmlDoc.CreateElement("Node");//创建一个<Node>节点
107
xe1.SetAttribute("genre","张三");//设置该节点genre属性
108
xe1.SetAttribute("ISBN","1-1111-1");//设置该节点ISBN属性
109
110
XmlElement xesub1=xmlDoc.CreateElement("title");
111
xesub1.InnerText="C#入门帮助";//设置文本节点
112
xe1.AppendChild(xesub1);//添加到<Node>节点中
113
XmlElement xesub2=xmlDoc.CreateElement("author");
114
xesub2.InnerText="高手";
115
xe1.AppendChild(xesub2);
116
XmlElement xesub3=xmlDoc.CreateElement("price");
117
xesub3.InnerText="158.3";
118
xe1.AppendChild(xesub3);
119
120
root.AppendChild(xe1);//添加到<Employees>节点中
121
xmlDoc.Save ( Server.MapPath("data.xml") );
122
123
//////////////////////////////////////////////////////////////////////////////////////
124
结果:在xml原有的内容里添加了一个结点,内容如下,
125
<?xml version="1.0"?>
126
<Employees>
127
<Node genre="李赞红" ISBN="2-3631-4">
128
<title>CS从入门到精通</title>
129
<author>候捷</author>
130
<price>58.3</price>
131
</Node>
132
<Node genre="李赞红" ISBN="2-3631-4">
133
<title>CS从入门到精通</title>
134
<author>候捷</author>
135
<price>58.3</price>
136
</Node>
137
<Node genre="张三" ISBN="1-1111-1">
138
<title>C#入门帮助</title>
139
<author>高手</author>
140
<price>158.3</price>
141
</Node>
142
</Employees>
143
144
3,修改结点的值(属性和子结点):
145
146
XmlDocument xmlDoc=new XmlDocument();
147
xmlDoc.Load( Server.MapPath("data.xml") );
148
149
XmlNodeList nodeList=xmlDoc.SelectSingleNode("Employees").ChildNodes;//获取Employees节点的所有子节点
150
151
foreach(XmlNode xn in nodeList)//遍历所有子节点
152
{
153
XmlElement xe=(XmlElement)xn;//将子节点类型转换为XmlElement类型
154
if(xe.GetAttribute("genre")=="张三")//如果genre属性值为“张三”
155
{
156
xe.SetAttribute("genre","update张三");//则修改该属性为“update张三”
157
158
XmlNodeList nls=xe.ChildNodes;//继续获取xe子节点的所有子节点
159
foreach(XmlNode xn1 in nls)//遍历
160
{
161
XmlElement xe2=(XmlElement)xn1;//转换类型
162
if(xe2.Name=="author")//如果找到
163
{
164
xe2.InnerText="亚胜";//则修改
165
}
166
}
167
}
168
}
169
xmlDoc.Save( Server.MapPath("data.xml") );//保存。
170
171
//////////////////////////////////////////////////////////////////////////////////////
172
结果:将原来的所有结点的信息都修改了,xml的内容如下,
173
<?xml version="1.0"?>
174
<Employees>
175
<Node genre="李赞红" ISBN="2-3631-4">
176
<title>CS从入门到精通</title>
177
<author>候捷</author>
178
<price>58.3</price>
179
</Node>
180
<Node genre="李赞红" ISBN="2-3631-4">
181
<title>CS从入门到精通</title>
182
<author>候捷</author>
183
<price>58.3</price>
184
</Node>
185
<Node genre="update张三" ISBN="1-1111-1">
186
<title>C#入门帮助</title>
187
<author>亚胜</author>
188
<price>158.3</price>
189
</Node>
190
</Employees>
191
192
4,修改结点(添加结点的属性和添加结点的自结点):
193
XmlDocument xmlDoc=new XmlDocument();
194
xmlDoc.Load( Server.MapPath("data.xml") );
195
196
XmlNodeList nodeList=xmlDoc.SelectSingleNode("Employees").ChildNodes;//获取Employees节点的所有子节点
197
198
foreach(XmlNode xn in nodeList)
199
{
200
XmlElement xe=(XmlElement)xn;
201
xe.SetAttribute("test","111111");
202
203
XmlElement xesub=xmlDoc.CreateElement("flag");
204
xesub.InnerText="1";
205
xe.AppendChild(xesub);
206
}
207
xmlDoc.Save( Server.MapPath("data.xml") );
208
209
//////////////////////////////////////////////////////////////////////////////////////
210
结果:每个结点的属性都添加了一个,子结点也添加了一个,内容如下,
211
<?xml version="1.0"?>
212
<Employees>
213
<Node genre="李赞红" ISBN="2-3631-4" test="111111">
214
<title>CS从入门到精通</title>
215
<author>候捷</author>
216
<price>58.3</price>
217
<flag>1</flag>
218
</Node>
219
<Node genre="李赞红" ISBN="2-3631-4" test="111111">
220
<title>CS从入门到精通</title>
221
<author>候捷</author>
222
<price>58.3</price>
223
<flag>1</flag>
224
</Node>
225
<Node genre="update张三" ISBN="1-1111-1" test="111111">
226
<title>C#入门帮助</title>
227
<author>亚胜</author>
228
<price>158.3</price>
229
<flag>1</flag>
230
</Node>
231
</Employees>
232
233
5,删除结点中的某一个属性:
234
XmlDocument xmlDoc=new XmlDocument();
235
xmlDoc.Load( Server.MapPath("data.xml") );
236
XmlNodeList xnl=xmlDoc.SelectSingleNode("Employees").ChildNodes;
237
foreach(XmlNode xn in xnl)
238
{
239
XmlElement xe=(XmlElement)xn;
240
xe.RemoveAttribute("genre");//删除genre属性
241
242
XmlNodeList nls=xe.ChildNodes;//继续获取xe子节点的所有子节点
243
foreach(XmlNode xn1 in nls)//遍历
244
{
245
XmlElement xe2=(XmlElement)xn1;//转换类型
246
if(xe2.Name=="flag")//如果找到
247
{
248
xe.RemoveChild(xe2);//则删除
249
}
250
}
251
}
252
xmlDoc.Save( Server.MapPath("data.xml") );
253
254
//////////////////////////////////////////////////////////////////////////////////////]
255
结果:删除了结点的一个属性和结点的一个子结点,内容如下,
256
<?xml version="1.0"?>
257
<Employees>
258
<Node ISBN="2-3631-4" test="111111">
259
<title>CS从入门到精通</title>
260
<author>候捷</author>
261
<price>58.3</price>
262
</Node>
263
<Node ISBN="2-3631-4" test="111111">
264
<title>CS从入门到精通</title>
265
<author>候捷</author>
266
<price>58.3</price>
267
</Node>
268
<Node ISBN="1-1111-1" test="111111">
269
<title>C#入门帮助</title>
270
<author>亚胜</author>
271
<price>158.3</price>
272
</Node>
273
</Employees>
274
275
6,删除结点:
276
XmlDocument xmlDoc=new XmlDocument();
277
xmlDoc.Load( Server.MapPath("data.xml") );
278
XmlNode root=xmlDoc.SelectSingleNode("Employees");
279
XmlNodeList xnl=xmlDoc.SelectSingleNode("Employees").ChildNodes;
280
for(int i=0;i<xnl.Count;i++)
281
{
282
XmlElement xe=(XmlElement)xnl.Item(i);
283
if(xe.GetAttribute("genre")=="张三")
284
{
285
root.RemoveChild(xe);
286
if(i<xnl.Count)i=i-1;
287
}
288
}
289
xmlDoc.Save( Server.MapPath("data.xml") );
290
291
//////////////////////////////////////////////////////////////////////////////////////]
292
结果:删除了符合条件的所有结点,原来的内容:
293
294
<?xml version="1.0"?>
295
<Employees>
296
<Node genre="李赞红" ISBN="2-3631-4">
297
<title>CS从入门到精通</title>
298
<author>候捷</author>
299
<price>58.3</price>
300
</Node>
301
<Node genre="李赞红" ISBN="2-3631-4">
302
<title>CS从入门到精通</title>
303
<author>候捷</author>
304
<price>58.3</price>
305
</Node>
306
<Node genre="张三" ISBN="1-1111-1">
307
<title>C#入门帮助</title>
308
<author>高手</author>
309
<price>158.3</price>
310
</Node>
311
<Node genre="张三" ISBN="1-1111-1">
312
<title>C#入门帮助</title>
313
<author>高手</author>
314
<price>158.3</price>
315
</Node>
316
</Employees>
317
318
删除后的内容:
319
<?xml version="1.0"?>
320
<Employees>
321
<Node genre="李赞红" ISBN="2-3631-4">
322
<title>CS从入门到精通</title>
323
<author>候捷</author>
324
<price>58.3</price>
325
</Node>
326
<Node genre="李赞红" ISBN="2-3631-4">
327
<title>CS从入门到精通</title>
328
<author>候捷</author>
329
<price>58.3</price>
330
</Node>
331
</Employees>
332
333
在C#.net中如何操作XML2
需要添加的命名空间:3
using System.Xml;4

5
定义几个公共对象:6
XmlDocument xmldoc ;7
XmlNode xmlnode ;8
XmlElement xmlelem ;9

10
1,创建到服务器同名目录下的xml文件:11

12

13
方法一:14
xmldoc = new XmlDocument ( ) ;15
//加入XML的声明段落16
xmlnode = xmldoc.CreateNode ( XmlNodeType.XmlDeclaration , "" , "" ) ;17
xmldoc.AppendChild ( xmlnode ) ;18
//加入一个根元素19
xmlelem = xmldoc.CreateElement ( "" , "Employees" , "" ) ;20
xmldoc.AppendChild ( xmlelem ) ;21
//加入另外一个元素22
for(int i=1;i<3;i++)23
{24

25
XmlNode root=xmldoc.SelectSingleNode("Employees");//查找<Employees> 26
XmlElement xe1=xmldoc.CreateElement("Node");//创建一个<Node>节点 27
xe1.SetAttribute("genre","李赞红");//设置该节点genre属性 28
xe1.SetAttribute("ISBN","2-3631-4");//设置该节点ISBN属性 29

30
XmlElement xesub1=xmldoc.CreateElement("title"); 31
xesub1.InnerText="CS从入门到精通";//设置文本节点 32
xe1.AppendChild(xesub1);//添加到<Node>节点中 33
XmlElement xesub2=xmldoc.CreateElement("author"); 34
xesub2.InnerText="候捷"; 35
xe1.AppendChild(xesub2); 36
XmlElement xesub3=xmldoc.CreateElement("price"); 37
xesub3.InnerText="58.3"; 38
xe1.AppendChild(xesub3); 39

40
root.AppendChild(xe1);//添加到<Employees>节点中 41
}42
//保存创建好的XML文档43
xmldoc.Save ( Server.MapPath("data.xml") ) ; 44

45
//////////////////////////////////////////////////////////////////////////////////////46
结果:在同名目录下生成了名为data.xml的文件,内容如下,47
<?xml version="1.0"?>48
<Employees>49
<Node genre="李赞红" ISBN="2-3631-4">50
<title>CS从入门到精通</title>51
<author>候捷</author>52
<price>58.3</price>53
</Node>54
<Node genre="李赞红" ISBN="2-3631-4">55
<title>CS从入门到精通</title>56
<author>候捷</author>57
<price>58.3</price>58
</Node>59
</Employees>60

61

62
方法二:63
XmlTextWriter xmlWriter;64
string strFilename = Server.MapPath("data1.xml") ;65

66
xmlWriter = new XmlTextWriter(strFilename,Encoding.Default);//创建一个xml文档67
xmlWriter.Formatting = Formatting.Indented;68
xmlWriter.WriteStartDocument();69
xmlWriter.WriteStartElement("Employees");70

71
xmlWriter.WriteStartElement("Node");72
xmlWriter.WriteAttributeString("genre","李赞红");73
xmlWriter.WriteAttributeString("ISBN","2-3631-4");74

75
xmlWriter.WriteStartElement("title");76
xmlWriter.WriteString("CS从入门到精通");77
xmlWriter.WriteEndElement();78

79
xmlWriter.WriteStartElement("author");80
xmlWriter.WriteString("候捷");81
xmlWriter.WriteEndElement();82

83
xmlWriter.WriteStartElement("price");84
xmlWriter.WriteString("58.3");85
xmlWriter.WriteEndElement();86

87
xmlWriter.WriteEndElement();88

89
xmlWriter.Close();90
//////////////////////////////////////////////////////////////////////////////////////91
结果:92
<?xml version="1.0" encoding="gb2312"?>93
<Employees>94
<Node genre="李赞红" ISBN="2-3631-4">95
<title>CS从入门到精通</title>96
<author>候捷</author>97
<price>58.3</price>98
</Node>99
</Employees>100

101
2,添加一个结点:102

103
XmlDocument xmlDoc=new XmlDocument(); 104
xmlDoc.Load(Server.MapPath("data.xml")); 105
XmlNode root=xmlDoc.SelectSingleNode("Employees");//查找<Employees> 106
XmlElement xe1=xmlDoc.CreateElement("Node");//创建一个<Node>节点 107
xe1.SetAttribute("genre","张三");//设置该节点genre属性 108
xe1.SetAttribute("ISBN","1-1111-1");//设置该节点ISBN属性 109

110
XmlElement xesub1=xmlDoc.CreateElement("title"); 111
xesub1.InnerText="C#入门帮助";//设置文本节点 112
xe1.AppendChild(xesub1);//添加到<Node>节点中 113
XmlElement xesub2=xmlDoc.CreateElement("author"); 114
xesub2.InnerText="高手"; 115
xe1.AppendChild(xesub2); 116
XmlElement xesub3=xmlDoc.CreateElement("price"); 117
xesub3.InnerText="158.3"; 118
xe1.AppendChild(xesub3); 119

120
root.AppendChild(xe1);//添加到<Employees>节点中 121
xmlDoc.Save ( Server.MapPath("data.xml") );122

123
//////////////////////////////////////////////////////////////////////////////////////124
结果:在xml原有的内容里添加了一个结点,内容如下,125
<?xml version="1.0"?>126
<Employees>127
<Node genre="李赞红" ISBN="2-3631-4">128
<title>CS从入门到精通</title>129
<author>候捷</author>130
<price>58.3</price>131
</Node>132
<Node genre="李赞红" ISBN="2-3631-4">133
<title>CS从入门到精通</title>134
<author>候捷</author>135
<price>58.3</price>136
</Node>137
<Node genre="张三" ISBN="1-1111-1">138
<title>C#入门帮助</title>139
<author>高手</author>140
<price>158.3</price>141
</Node>142
</Employees>143

144
3,修改结点的值(属性和子结点):145

146
XmlDocument xmlDoc=new XmlDocument(); 147
xmlDoc.Load( Server.MapPath("data.xml") ); 148

149
XmlNodeList nodeList=xmlDoc.SelectSingleNode("Employees").ChildNodes;//获取Employees节点的所有子节点 150

151
foreach(XmlNode xn in nodeList)//遍历所有子节点 152
{ 153
XmlElement xe=(XmlElement)xn;//将子节点类型转换为XmlElement类型 154
if(xe.GetAttribute("genre")=="张三")//如果genre属性值为“张三” 155
{ 156
xe.SetAttribute("genre","update张三");//则修改该属性为“update张三” 157

158
XmlNodeList nls=xe.ChildNodes;//继续获取xe子节点的所有子节点 159
foreach(XmlNode xn1 in nls)//遍历 160
{ 161
XmlElement xe2=(XmlElement)xn1;//转换类型 162
if(xe2.Name=="author")//如果找到 163
{ 164
xe2.InnerText="亚胜";//则修改165
} 166
} 167
} 168
} 169
xmlDoc.Save( Server.MapPath("data.xml") );//保存。170

171
//////////////////////////////////////////////////////////////////////////////////////172
结果:将原来的所有结点的信息都修改了,xml的内容如下,173
<?xml version="1.0"?>174
<Employees>175
<Node genre="李赞红" ISBN="2-3631-4">176
<title>CS从入门到精通</title>177
<author>候捷</author>178
<price>58.3</price>179
</Node>180
<Node genre="李赞红" ISBN="2-3631-4">181
<title>CS从入门到精通</title>182
<author>候捷</author>183
<price>58.3</price>184
</Node>185
<Node genre="update张三" ISBN="1-1111-1">186
<title>C#入门帮助</title>187
<author>亚胜</author>188
<price>158.3</price>189
</Node>190
</Employees>191

192
4,修改结点(添加结点的属性和添加结点的自结点):193
XmlDocument xmlDoc=new XmlDocument(); 194
xmlDoc.Load( Server.MapPath("data.xml") ); 195

196
XmlNodeList nodeList=xmlDoc.SelectSingleNode("Employees").ChildNodes;//获取Employees节点的所有子节点 197

198
foreach(XmlNode xn in nodeList) 199
{ 200
XmlElement xe=(XmlElement)xn; 201
xe.SetAttribute("test","111111");202

203
XmlElement xesub=xmlDoc.CreateElement("flag"); 204
xesub.InnerText="1"; 205
xe.AppendChild(xesub); 206
} 207
xmlDoc.Save( Server.MapPath("data.xml") );208

209
//////////////////////////////////////////////////////////////////////////////////////210
结果:每个结点的属性都添加了一个,子结点也添加了一个,内容如下,211
<?xml version="1.0"?>212
<Employees>213
<Node genre="李赞红" ISBN="2-3631-4" test="111111">214
<title>CS从入门到精通</title>215
<author>候捷</author>216
<price>58.3</price>217
<flag>1</flag>218
</Node>219
<Node genre="李赞红" ISBN="2-3631-4" test="111111">220
<title>CS从入门到精通</title>221
<author>候捷</author>222
<price>58.3</price>223
<flag>1</flag>224
</Node>225
<Node genre="update张三" ISBN="1-1111-1" test="111111">226
<title>C#入门帮助</title>227
<author>亚胜</author>228
<price>158.3</price>229
<flag>1</flag>230
</Node>231
</Employees>232

233
5,删除结点中的某一个属性:234
XmlDocument xmlDoc=new XmlDocument(); 235
xmlDoc.Load( Server.MapPath("data.xml") ); 236
XmlNodeList xnl=xmlDoc.SelectSingleNode("Employees").ChildNodes; 237
foreach(XmlNode xn in xnl) 238
{ 239
XmlElement xe=(XmlElement)xn; 240
xe.RemoveAttribute("genre");//删除genre属性 241

242
XmlNodeList nls=xe.ChildNodes;//继续获取xe子节点的所有子节点 243
foreach(XmlNode xn1 in nls)//遍历 244
{ 245
XmlElement xe2=(XmlElement)xn1;//转换类型 246
if(xe2.Name=="flag")//如果找到 247
{ 248
xe.RemoveChild(xe2);//则删除249
} 250
} 251
} 252
xmlDoc.Save( Server.MapPath("data.xml") ); 253

254
//////////////////////////////////////////////////////////////////////////////////////]255
结果:删除了结点的一个属性和结点的一个子结点,内容如下,256
<?xml version="1.0"?>257
<Employees>258
<Node ISBN="2-3631-4" test="111111">259
<title>CS从入门到精通</title>260
<author>候捷</author>261
<price>58.3</price>262
</Node>263
<Node ISBN="2-3631-4" test="111111">264
<title>CS从入门到精通</title>265
<author>候捷</author>266
<price>58.3</price>267
</Node>268
<Node ISBN="1-1111-1" test="111111">269
<title>C#入门帮助</title>270
<author>亚胜</author>271
<price>158.3</price>272
</Node>273
</Employees>274

275
6,删除结点:276
XmlDocument xmlDoc=new XmlDocument(); 277
xmlDoc.Load( Server.MapPath("data.xml") ); 278
XmlNode root=xmlDoc.SelectSingleNode("Employees");279
XmlNodeList xnl=xmlDoc.SelectSingleNode("Employees").ChildNodes; 280
for(int i=0;i<xnl.Count;i++)281
{282
XmlElement xe=(XmlElement)xnl.Item(i); 283
if(xe.GetAttribute("genre")=="张三") 284
{ 285
root.RemoveChild(xe);286
if(i<xnl.Count)i=i-1;287
} 288
}289
xmlDoc.Save( Server.MapPath("data.xml") ); 290

291
//////////////////////////////////////////////////////////////////////////////////////]292
结果:删除了符合条件的所有结点,原来的内容:293

294
<?xml version="1.0"?>295
<Employees>296
<Node genre="李赞红" ISBN="2-3631-4">297
<title>CS从入门到精通</title>298
<author>候捷</author>299
<price>58.3</price>300
</Node>301
<Node genre="李赞红" ISBN="2-3631-4">302
<title>CS从入门到精通</title>303
<author>候捷</author>304
<price>58.3</price>305
</Node>306
<Node genre="张三" ISBN="1-1111-1">307
<title>C#入门帮助</title>308
<author>高手</author>309
<price>158.3</price>310
</Node>311
<Node genre="张三" ISBN="1-1111-1">312
<title>C#入门帮助</title>313
<author>高手</author>314
<price>158.3</price>315
</Node>316
</Employees>317

318
删除后的内容:319
<?xml version="1.0"?>320
<Employees>321
<Node genre="李赞红" ISBN="2-3631-4">322
<title>CS从入门到精通</title>323
<author>候捷</author>324
<price>58.3</price>325
</Node>326
<Node genre="李赞红" ISBN="2-3631-4">327
<title>CS从入门到精通</title>328
<author>候捷</author>329
<price>58.3</price>330
</Node>331
</Employees>332

333




浙公网安备 33010602011771号