C#删除XML结点的简单例子
接上一篇
删除原genre属性,删除leixing=love的所有结点。
1 原xml文件 bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="love" ISBN="1234123">
<title>who am i </title>
<author>who</author>
<price>999</price>
</book>
<book leixing="love" ISBN="56756">
<title>CS从入门到精通</title>
<author>黎明</author>
<price>222</price>
</book>
</bookstore>
2 program.cs
using System;
using System.Xml;
namespace ReadXml
{
class Class1
{
static void Main(string[] args)
{
//实例化一个XmlDocument对象
XmlDocument xmlDoc = new XmlDocument();
//实例对象读取要写入的XML文件
xmlDoc.Load("bookstore.xml");
XmlNodeList xnl = xmlDoc.SelectSingleNode("bookstore").ChildNodes;
foreach (XmlNode xn in xnl)
{
XmlElement xe = (XmlElement)xn;
if (xe.GetAttribute("genre") == "love")
{
&n
相关文档:
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Syste ......
ZT:http://www.mobpub.net/archiver/?tid-28.html
Symbian学习笔记(15)——解析XML文件(上)
今天想分享的是如何在Symbian平台上解析XML文件,不需要第三方的东西,Symbian已经为我们提供了这个类CParser。
网上也有这方面的资料,建议参考:
[url]http://wiki.forum.nokia.com/index.php/How_to_parse_XML_fi ......
XML中一种扩展的标记语言,它具有很好的扩展性标记.本文通过XML实现不同数据库的定义,实现对XML数据库的访问和异构数据库之间的互访.
关键词:XML 异构数据库 信息交换 数据库访问
1 引言
XML(Extensible Markup Language)它是由W3C组织于1998年2月 &nb ......
详细介绍Flex中操作XML(上)
2009年12月30日 星期三 12:05
一 在介绍Flex中操作XML之前,首先简单介绍下XML中的基本术语。
元素:XML中拥有开始标签和结束标签的这一块称为“元素”
节点:把XML元素与文本结合起来统称为节点
根节点:位于整个XML文 ......