Use XML in Windows Phone 8.0
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的更多相关文章
- ava.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind (解决思路)
当我们在启动tomcat服务的时候报错信息:java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bin 分析:从错 ...
- java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind 【 解决方案】
当我们在启动tomcat服务的时候报错信息:java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bin 分析:从错 ...
- 用Advanced Installer制作DotNetBar for Windows Forms 12.0.0.1_冰河之刃重打包版详解
关于 DotNetBar for Windows Forms 12.0.0.1_冰河之刃重打包版 --------------------11.8.0.8_冰河之刃重打包版-------------- ...
- Git for Windows v2.11.0 Release Notes
homepage faq contribute bugs questions Git for Windows v2.11.0 Release Notes Latest update: December ...
- Windows Phone 8.0 SDK Update(10322) Released
昨天微软低调发布了WP 8 SDK的更新,甚至在Windows Phone Developer Blog上都没有提及. 从开发者的角度来看,此次更新的确没有太多需要关注的地方,因为没有添加新的API和 ...
- 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 ...
- Unrecognized Windows Sockets error: 0: JVM_Bind 异常怎么办
Unrecognized Windows Sockets error: 0: JVM_Bind 异常解决办法 java.net.SocketException: Unrecognized Window ...
- 与众不同 windows phone 8.0 & 8.1 系列文章索引
[源码下载] [与众不同 windows phone 7.5 (sdk 7.1) 系列文章索引] 与众不同 windows phone 8.0 & 8.1 系列文章索引 作者:webabcd ...
- Unrecognized Windows Sockets error: 0: JVM_Bind
Unrecognized Windows Sockets error: 0: JVM_Bind [转帖]今天很是奇怪,在运行服务器端的时候,经常遇到这个异常: java.net.SocketExcep ...
随机推荐
- 《Play for Java》学习笔记(一)项目框架
从今天开始认真复习<Play for JAVA>,该书以一个案例为主线,以前为应付项目马马虎虎看了一遍,好多地方都不明白!现在跟着这本书再走一遍,认真模拟,当做一个项目啦!! 一.Play ...
- [转]连续创建多个Oracle触发器失败,单个创建才成功的解决方法
连续创建多个Oracle触发器失败,单个创建才成功的解决方法 1.当我连续执行创建多个触发器时,总是报编译通过,但存在警告或错误.如下: create or replace trigger t ...
- mysql在一台服务器搭建主从
注:本环境事先执行rm -rf /usr/local/mysql 以方便实验. 1. 主与从,类似于A机器和B机器的连接,通过bin_log和rpel_log 进行数据连接 2. 如图所示: 3. ...
- 注册并启动 Reporting Services SharePoint 服务
在安装 SharePoint 之前已安装 Reporting Services SharePoint 模式.所以Reporting Services SharePoint 是不能正常使用的. 安装完S ...
- 投资统计查询sql
select COUNT(*) from YYD_Users_RegInfo where regTime between '2016-07-11 00:00:00' and '2016-07-11 2 ...
- LinearLayout练习
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- bzoj 2152: 聪聪可可
#include<cstdio> #include<algorithm> using namespace std; ; ],head[N],son[N],f[N],d[N],r ...
- 安装VMWare tools,以及解决安装后/mnt中有hgfs但没共享文件的方法
一.首先是安装VMWare tools 安装过程可参考:Installing VMware Tools in an Ubuntu virtual machine 安装成功后,可看的如下信息: ...
- Redis系列-存储篇set主要操作函数小结
最近,总是以“太忙“为借口,很久没有blog了,凡事贵在恒,希望我能够坚持不懈,毕竟在blog的时候,也能提升自己.废话不说了,直奔主题”set“ redis set 是string类型对象的无序集合 ...
- iOS中实现多线程的技术方案
pthread 实现多线程操作 代码实现: void * run(void *param) { for (NSInteger i = 0; i < 1000; i++) { ...