How to write to an XML file from the iPad OS?

笑着哭i 提交于 2019-12-08 05:15:36

问题


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, http://developer.apple.com/mac/library/documentation/cocoa/reference/foundation/Classes/NSXMLDocument_Class/Reference/Reference.html

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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/2869252/how-to-write-to-an-xml-file-from-the-ipad-os

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!