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. 分享一个快速的Json(反)序列化开源项目 Jil

    我们不缺少JSON的序列化库,但我们缺少一个性能非常好的库,这对于网站来说非常重要.今天我发现了Jil. 他是开源的代码: https://github.com/kevin-montrose/Jil ...

  2. arrow css

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. CentOS 常用命令大全(2)

    系统 # uname -a               # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue   # 查看操作系统版本 # cat /proc/cpuinf ...

  4. Spring mvc中使用request和response

    @ResponseBody @RequestMapping(value="/ip", method=RequestMethod.GET) public String getIP(H ...

  5. 绑定本地Service并与之通信-----之一

    import android.app.Service;import android.content.Intent;import android.os.Binder;import android.os. ...

  6. sql语句查询重复的数据

    查找所有重复标题的记录: SELECT *FROM t_info aWHERE ((SELECT COUNT(*)FROM t_infoWHERE Title = a.Title) > 1)OR ...

  7. hdu 4632 Palindrome subsequence

    http://acm.hdu.edu.cn/showproblem.php?pid=4632 简单DP 代码: #include<iostream> #include<cstdio& ...

  8. 2.精通前端系列技术之seajs和gruntJs结合开发(三)

    1.我们先来了解下模块化历史 模块化历史 nodeJS的出现(http://nodejs.org/) commonJS规范(http://www.commonjs.org/) 浏览器JS的模块化? A ...

  9. xml装php数组

    $data = simplexml_load_string($res, 'SimpleXMLElement', LIBXML_NOCDATA); $arr = converArray($data); ...

  10. APP store 官方统计工具的常见的Q&A

    Apple最近在iTunesConnect里最新发布了官方统计工具,提供了现有友盟统计平台和自有统计平台无法统计的数据,具有自己的独有特点,尤其是下面几个最让人头疼的流量分析转化,可以在App Ana ...