如何编写XML文件?
我想在我的应用程序中编写一个不太复杂但很大的文件,并能够通过邮件发送它(使用 MFMailComposeViewController) 由于 NSXMLElement 和相关类未移植到 iPhone SDK,我有什么选项来创建 XML 文档? 提前致谢。
I want to write a not so complicated but large file within my app and be able to send it by mail (using MFMailComposeViewController)
Since NSXMLElement and related classes are not ported to iPhone SDK what options do I have for creating XML documents?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我建议使用 KissXML。作者的情况与您类似,并围绕 libxml 创建了一个 NSXML 兼容的 API 包装器。他在博客上此处讨论了选项和决定。
I would recommend using KissXML. The author started in a similar situation as you and created an NSXML compatible API wrapper around libxml. He discusses the options and decisions here on his blog.
无耻的自我推销:KSXMLWriter
Shameless self-promotion: KSXMLWriter
尝试使用开源适用于 iOS 的 XML 流编写器:
示例:
这会生成以下 XML 字符串:
Try the open source XML stream writer for iOS:
Example:
This produces the following XML string:
这是 NSString 构建的家庭作业。抽象地说,创建一个如下协议:
确保您保存的所有内容都实现它,并使用如下内容构建 XML:
It's a homework exercise in NSString building. Abstractly, create a protocol like:
Make sure everything you're saving implements it and build the XML with something like the following: