简体   繁体   English

如何从xml文件获取数据

[英]How to get the data from xml file

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. 我有一个应用程序,它将地图与用户的位置,2张图片和xml文件中的一些文本绑定在一起,然后通过电子邮件发送给其他用户。 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). 现在的问题是,如果其他用户正在接收它,我应该如何在我的应用程序中解析此xml文件,以便接收者可以对数据有一个明智的印象,例如带有两个标签(图片和注释)的地图。 The basic question is how i can read the sent xml file at receiver's end. 基本问题是我如何在接收方读取已发送的xml文件。

Thanks, 谢谢,

At the sender's end, create an NSDictionary containing the location, the data of the two UIImage s and the NSString . 在发送者端,创建一个NSDictionary其中包含位置,两个UIImageNSString Then, save it as a plist , and send it via email. 然后,将其另存为plist ,然后通过电子邮件发送。 Then, at the receiver's end, create an NSDictionary 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. 然后,在接收者端,使用文件内容创建一个NSDictionaryNSDictionary *dataDict = [[NSDictionary alloc] initWithContentsOfFile:YOUR_FILE]; ),然后使用添加时为它们设置的相关键来获取对象。他们去字典。

Hope this helps, 希望这可以帮助,
jrtc27 jrtc27

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM