C#修改XML的简单例子
接上一篇《C#写XML的简单例子》
这个例子要修改XML文件中结点的属性和和元素的文本
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="music" ISBN="56756">
<title>CS从入门到精通</title>
<author>候捷</author>
<price>222</price>
</book>
</bookstore>
2 program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
//实例化一个XmlDocument对象
XmlDocument xmlDoc = new XmlDocument();
//实例对象读取要写入的XML文件
xmlDoc.Load("bookstore.xml");
//获取bookstore节点的所有子节点
XmlNodeList nodeList = xmlDoc.SelectSingleNode("bookstore").ChildNodes;
//遍历所有子节点
foreach (XmlNode xn in nodeList)
{
//将子节点类型
相关文档:
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 ......
1、mian.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="HTTPSrv.send();" width="242" height="442">
<mx:Script>
<!--[CDATA[
import mx.rpc.events.ResultEv ......
以下为一天的基本学习情况,包括学习和复习,模式部分前前后后也看了很多了,但是一直没能坚持看完,希望这次可以坚持下去。
模式部分我没有直接去看比较经典的《java与模式》,这书太厚容易让我坚持不下去,而是采用了程杰写的《大话设计模式》,
这书写的很有意思,也很容易理解。希望这样的书可以多些。呵呵,当然等看 ......
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 ......