- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
xml的追加、删除(XML append, delete)
xml的追加、删除(XML append, delete)
Known to have a XML file (bookstore.xml):
? XML version= 1 encoding= GB2312 ?
bookstore
book genre= fantasy ISBN= 2-3631-4
titleOberons Legacy/title
authorCorets, Eva/author
price5.95/price
/book
/bookstore
1, to the bookstore node in the insertion of a book node:
XmlDocument xmlDoc=new (XmlDocument);
XmlDoc.Load (bookstore.xml);
XmlNode root=xmlDoc.SelectSingleNode (bookstore); / / find bookstore
XmlElement xe1=xmlDoc.CreateElement (book); / / create a book node
Xe1.SetAttribute (genre, Li Zanhong); / / set the genre attribute node
Xe1.SetAttribute (ISBN, 2-3631-4); / / set the ISBN attribute node
XmlElement xesub1=xmlDoc.CreateElement (title);
Xesub1.InnerText= CS from entry to the master; / / set the text node
Xe1.AppendChild (xesub1); / / add to the book node
XmlElement xesub2=xmlDoc.CreateElement (author);
Xesub2.InnerText= Hou jie;
Xe1.AppendChild (xesub2);
XmlElement xesub3=xmlDoc.CreateElement (price);
Xesub3.InnerText= 58.3;
Xe1.AppendChild (xesub3);
Root.AppendChild (xe1); / / add to the bookstore node
XmlDoc.Save (bookstore.xml);
//===============================================
As a result:
? XML version= 1 encoding= GB2312 ?
bookstore
book genre= fantasy ISBN= 2-3631-4
titleOberons Legacy/title
authorCorets, Eva/author
price5.95/price
/book
book genre= Li Zanhong ISBN= 2-3631-4
titleCS from entry to the master /title
author Hou Jie /author
price58.3/price
/book
/bookstore
2, modify node: genre value of Li Zanhong of the nodes genre value to update Li Zanhong, the text author the child nodes of the node changes as yasheng.
XmlNodeList nodeList=xmlDoc.SelectSingleNode.ChildNodes (bookstore); / / all child nodes to obtain Bookstore node
Foreach (XmlNode xn in nodeList) / / traversal of all child nodes
{
XmlElement xe= xn (XmlElement); / / sub node type conversion type XmlElement
If (xe.
getattribute (genre) = = 李赞红) / / 如果genre属性值为 李赞红
{
xe.setattribute (genre, update李赞红); / / 则修改该属性为 update李赞红
xmlnodelist nls = xe.childnod
您可能关注的文档
- macd指标分析(MACD index analysis).doc
- macd指标的实战技巧(Combat skills MACD index).doc
- macd用法(MACD usage).doc
- macd的使用方法(The use of MACD).doc
- mapgis实用方法及技巧(MAPGIS practical methods and skills).doc
- macd经典买点)(MACD classic buy)).doc
- mapgis对于地质图图的制作过程(MAPGIS for the production process of geological Tutu).doc
- lockdir普通强度加密破解说明(Lockdir common strength encryption instructions).doc
- mapgis教程(MAPGIS tutorial).doc
- matlab plot函数说明,坐标轴,legend函数的基本用法(The MATLAB plot function that coordinates, basic usage of legend function).doc
- xsl概念.doc
- xxxx学院学年第二学期期末考试试卷(XXXX school year second semester final exam).doc
- xin汽车空调技术浅析(Analysis of Xin automotive air conditioning technology).doc
- xx县农村基层政权建设工作调研情况汇报(The investigation of rural grassroots regime construction work reports on the situation of XX County).doc
- x大工11秋《工程力学》(二)在线作业1-3(X engineering mechanics work 11 autumn (two) online homework 1-3).doc
- z11-12齿轮强度计算(The gear strength calculation of z11-12).doc
- yz液下渣浆泵(YZ slurry).doc
- xx镇2005上半年基层组织建设工作自查总结(The town of XX in the first half of 2005 basic level organization construction work of self-examination and summary).doc
- zbrush中英文对照表(ZBrush English table).doc
- zfb05与ga06(Zfb05 and ga06).doc
文档评论(0)