如何从xml文件中获取数据
我有一个应用程序,它将地图与用户的位置、2 张图片和 xml 文件中的一些文本绑定在一起,并通过电子邮件将其发送给其他用户。 现在的问题是,如果其他用户正在接收它,我应该如何在我的应用程序中解析这个 xml 文件,以便接收者可以对数据有一个合理的外观,例如带有两个选项卡(图片和评论)的地图。 基本问题是我如何在接收方读取发送的 xml 文件。
谢谢,
I have an application which binds a map with user's location, 2 pictures and some text in the xml file and send it to the other user through email.
Now the question is that if the other user who is receiving it, how i should make this xml file parsed in my application so that the receiver can have a sensible look of the data like the map with two tabs (pictures and comments).
The basic question is how i can read the sent xml file at receiver's end.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在发送者端,创建一个
NSDictionary
,其中包含位置、两个UIImage
的数据以及NSString
。然后,将其保存为plist
,并通过电子邮件发送。然后,在接收器端,使用文件内容创建一个NSDictionary
(NSDictionary *dataDict = [[NSDictionary alloc] initWithContentsOfFile:YOUR_FILE];
),然后获取使用您将对象添加到字典时为其设置的相关键的对象。希望这有帮助,
jrtc27
At the sender's end, create an
NSDictionary
containing the location, the data of the twoUIImage
s and theNSString
. Then, save it as aplist
, and send it via email. Then, at the receiver's end, create anNSDictionary
with the contents of the file (NSDictionary *dataDict = [[NSDictionary alloc] initWithContentsOfFile:YOUR_FILE];
), and then get the objects using the relevant keys that you set for them when you added them to the dictionary.Hope this helps,
jrtc27