开发者

How to write to an XML file from iOS?

开发者 https://www.devze.com 2022-12-31 03:17 出处:网络
I am developing an app for iPad, and I need to modify several attributes in a XML file at runtime. I found the class NSXMLDocument. But I haven\'t been able to import it to my project.

I am developing an app for iPad, and I need to modify several attributes in a XML file at runtime.

I found the class NSXMLDocument. But I haven't been able to import it to my project.

Is this class not available for iPhone/iPad development?开发者_运维知识库

Is there some other approach I can consider?

I read about libxml library. Is it my answer or there is a better approach?


NSXMLDocument is MacOS X Cocoa only. You have available on iPhone NSXMLParser, and several external libraries built on libxml2 - TouchXML, KissXML and a couple of others.

Note that KissXML supports writing XML.

Other XML libraries that have been suggested include the XML support from Google Data and VTD-XML.


You are looking for a DOM XML parser, which is best for modification of XML documents. See for example this tutorial - without mapping to and from Model Objects - use the XPath.

0

精彩评论

暂无评论...
验证码 换一张
取 消