How do I parse an NSString containing XML in Objective-C?

Download:
https://github.com/bcaccinolo/XML-to-NSDictionary

Then you simply do :

NSDictionary *dic = [XMLReader dictionaryForXMLString:myxml error:nil];

Result is a NSDictionary *dic with dictionaries, arrays and strings inside, depending of the XML:

{
    students =     {
        student =         {
            address = abcd;
            age = 25;
            name = Raju;
        };
    };
}

Leave a Comment