I have an XML file stored in DataModel folder, the structure is shown as below:

<?xml version="1.0" encoding="utf-8" ?>
<Bible>
<Setting>
<a>1</a>
<b>2</b>
<c>3</c>
</Setting>
<books>
<book id="a">
<display>aaaaaaaa</display>
</book>
</books>
</Bible>

In windows phone 8.0, there is a way to use Dom:

using Windows.Storage;
using Windows.Data.Xml.Dom;
public async void ManipulateXML()
{
string file = @"ms-appx:///DataModel/Data.xml";
Uri url = new Uri(file);
StorageFile sFile = await StorageFile.GetFileFromApplicationUriAsync(url); string stream = await FileIO.ReadTextAsync(sFile);
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(stream); // append node
var node = xDoc.SelectSingleNode("/Bible/Setting");
XmlElement ele1 = xDoc.CreateElement("program");
ele1.InnerText = "this is created by program";
ele1.SetAttribute("ID", "Third");
node.AppendChild(ele1);
await xDoc.SaveToFileAsync(sFile); // remove node
var settings = xDoc.SelectSingleNode("/Bible/Setting");
var nodes = xDoc.SelectNodes("/Bible/Setting/program");
int count = nodes.Count;
for (int i = ; i < count; i++)
{
settings.RemoveChild(nodes[i]);
await xDoc.SaveToFileAsync(sFile);
}
}

Use XML in Windows Phone 8.0的更多相关文章

  1. ava.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind (解决思路)

    当我们在启动tomcat服务的时候报错信息:java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bin 分析:从错 ...

  2. java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind 【 解决方案】

    当我们在启动tomcat服务的时候报错信息:java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bin 分析:从错 ...

  3. 用Advanced Installer制作DotNetBar for Windows Forms 12.0.0.1_冰河之刃重打包版详解

    关于 DotNetBar for Windows Forms 12.0.0.1_冰河之刃重打包版 --------------------11.8.0.8_冰河之刃重打包版-------------- ...

  4. Git for Windows v2.11.0 Release Notes

    homepage faq contribute bugs questions Git for Windows v2.11.0 Release Notes Latest update: December ...

  5. Windows Phone 8.0 SDK Update(10322) Released

    昨天微软低调发布了WP 8 SDK的更新,甚至在Windows Phone Developer Blog上都没有提及. 从开发者的角度来看,此次更新的确没有太多需要关注的地方,因为没有添加新的API和 ...

  6. Windows Phone 8.0 Updates 2 and 3模拟器更新

    2014年元旦后,微软发布了Windows Phone 8 Updates 2 and 3的模拟器更新,即系统版本号分别是8.0.10322和 8.0.10512.其中,在Update 3 Emula ...

  7. Unrecognized Windows Sockets error: 0: JVM_Bind 异常怎么办

    Unrecognized Windows Sockets error: 0: JVM_Bind 异常解决办法 java.net.SocketException: Unrecognized Window ...

  8. 与众不同 windows phone 8.0 & 8.1 系列文章索引

    [源码下载] [与众不同 windows phone 7.5 (sdk 7.1) 系列文章索引] 与众不同 windows phone 8.0 & 8.1 系列文章索引 作者:webabcd ...

  9. Unrecognized Windows Sockets error: 0: JVM_Bind

    Unrecognized Windows Sockets error: 0: JVM_Bind [转帖]今天很是奇怪,在运行服务器端的时候,经常遇到这个异常: java.net.SocketExcep ...

随机推荐

  1. MATLAB画图

    画图代码 clear % http://www.peteryu.ca/tutorials/matlab/visualize_decision_boundaries % load RankData % ...

  2. 告别node-forever,拥抱PM2

    告别node-forever,拥抱PM2 返回原文英文原文:Goodbye node-forever,hello PM2 devo.ps团队对JavaScript的迷恋已经不是什么秘密了;node.j ...

  3. CentOS Hadoop格式化HDFS异常java.net.UnknownHostException

    #bin/hadoop namenode -format DEPRECATED: Use of this script to execute hdfs command is deprecated. I ...

  4. 161018--NOIP模拟

    老实说,感觉自己好菜啊..(安慰自己省选做多了 T1:看似1e6很大,实际上常数52都能草过去...不知为何RE.. T2:记忆化搜索.看错题目条件QAQ,其实把自己暴力搜的程序改改就好了.. T3: ...

  5. bzoj 2324: [ZJOI2011]营救皮卡丘

    #include<cstdio> #include<iostream> #include<cstring> #include<cmath> #inclu ...

  6. CentOS下编译安装MySQL 5.6.21

    一.编译安装MySQL前的准备工作 安装编译源码所需的工具和库 yum install gcc gcc-c++ ncurses-devel perl 安装cmake:http://www.cnblog ...

  7. opencv实现图片缩放

    源码 #include <iostream> #include <opencv2/core/core.hpp> #include <opencv2/imgproc/img ...

  8. Section 1.4 Packing Rectangles

    本来是USACO Training的1.4.1的,但是介于今早过了食物链想起了这道题实在是太怨念了,翻出自己写的AC程序居然有5KB!! 思路很简单,枚举,而且就图中的六种情况.但是第六种变化状况太多 ...

  9. 自定义ImageView

    package com.example.myimageview; import android.content.Context;import android.graphics.Bitmap;impor ...

  10. Android中 服务里的方法抽取成接口

    1 写个类继承Service 重写 onBind方法 返回一个IBinder 对象(传递到连接成功时用) 2 服务中 写一个内部类 继承IBinder 并且实现一个接口(用于抽取方法)继承IBinde ...