Reputation: 125
NSString *xml=@"<string>aaaa</string><string>bbbb</string><string>ccccc</string>";
I Want to store text of every elemnt in NSMutableArray
Upvotes: 0
Views: 743
Reputation: 4527
You can better use the NSXMLParser for the purpose. Hope this helps you.
Upvotes: 0
Reputation: 39988
Either you use xml parser which is the best option.
I suggest you TBXML and its performance is better than others
or
Try this. mtbArray
is you all require
NSString *xml=@"<string>aaaa</string><string>bbbb</string><string>ccccc</string>";
xml = [xml stringByReplacingOccurrencesOfString:@"</string>" withString:@""];
NSArray *array = [xml componentsSeparatedByString:@"<string>"];
NSMutableArray *mtbArray = [array mutableCopy];
if ([mtbArray count]) {
[mtbArray removeObjectAtIndex:0];
}
Upvotes: 1