Created
April 1, 2013 02:40
-
-
Save hasyimibhar/5282951 to your computer and use it in GitHub Desktop.
Convert NSDictionary to XML string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *)convertToXml:(NSDictionary *)dictionary { | |
NSMutableString *xmlString = [[NSMutableString alloc] init]; | |
for (NSString *key in [dictionary allKeys]) { | |
id value = [dictionary objectForKey:key]; | |
[xmlString appendFormat:@"<%@>%@</%@>\n", key, value, key]; | |
} | |
return [NSString stringWithString:xmlString]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment