如何在Cocoa Touch中读取和写入XML? [英] How do I read and write XML in Cocoa Touch?

查看:120
本文介绍了如何在Cocoa Touch中读取和写入XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Objective-C创建一个文件,它存储了来自XML的数据。我也要做基本的函数读写文件。

I want to create a file using Objective-C, which stores the data comes from XML. I also have to do basic functions of read and write into that file. How can I do this?

推荐答案

您可以使用NSXMLParser类来解析自定义模式。这是特别有用的,因为NSXMLDocument类不幸地不存在于iPhone上。幸运的是,NSXMLParser是相当容易使用。我在半小时内使用NSXMLParser编写了一个RSS feed解析器。

You can parse a custom schema using the NSXMLParser class. This is especially useful since the NSXMLDocument class unfortunately does not exist on the iPhone. Thankfully, NSXMLParser is pretty easy to use. I've written an RSS feed parser using NSXMLParser in under half an hour.

这篇关于如何在Cocoa Touch中读取和写入XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆