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 ...
随机推荐
- SAP客户标准信用额度修改和创建
好吧,前提要说一下,信贷是到客户的信贷范围级别的. FUNCTION zfm_credit. *"---------------------------------------------- ...
- windows下捕获dump之守护进程
一两个月前为产品写了一个独立的exe,由于产品使用的捕获dump是一个现成的进程外exe,如果以资源的方式集成它容易出现安全警告,由于时间关系没有寻求新的解决方法,还是遵循旧方案,不捕获dump. 最 ...
- java之进制转换
[转载]晨风�0�5�0�2�0�1�6�6 2014年03月08日 于 爱Java 发表 众所周知.程序世界计算机中采用的是二进制,一个数字可以用任意进制表示.所以看一个数据值的同时.还要观察它的进 ...
- dos.orm学习地址
os.ORM(原Hxj.Data)于2009年发布.2015年正式开源,该组件已在数百个成熟项目中应用,是目前国内.Net用户量最多.最活跃.最完善的国产ORM.初期开发过程参考了NBear与MySo ...
- tabbarcontroller 内嵌导航 控制器,2层push hide tabbar 后 ,第二层直接返回根视图控制器选择tabbarcontroller的其它vc 无法显示 tabbar的 问题解决方案
场景如标题 这样不行: [self.navigationController popToRootViewControllerAnimated:YES]; MainViewController *mai ...
- [windows操作系统]windows模块
smss.exe csrss.exe Client/Server Runtime Server Subsystem
- 记录一些容易忘记的属性 -- UIGestureRecognize手势
//一个手势只能添加到一个view上面 //设置当前手势需要的点击次数 _tapRec.numberOfTapsRequired = 1;//(默认为1) //设置当前需要几个手指同时点击 ...
- What am I missing out in life if I don't have a girlfriend?
http://www.quora.com/What-am-I-missing-out-in-life-if-I-dont-have-a-girlfriend/answer/Kelly-Erickson ...
- Windows下LDAP服务器配置
LDAP即轻量级目录访问协议(Lightweight Directory Access Protocol),基础知识不再赘述,本文主要记录我的配置与安装过程. LDAP for windows下载 o ...
- GET,POST——简述
本文主要对GET与POST基本区别进行汇总并掌握. HTTPHTTP(即超文本传输协议)是现代网络中最常见和常用的协议之一,设计它的目的是保证客户机和服务器之间的通信.HTTP 的工作方式是客户端与服 ...