Search code examples
iphoneiosipadios4xmlreader

XMLReader : get attributes value from NSDictionary


I'm using the XMLReader class from http://troybrant.net/blog/,
it parsea an xml into an NSDictionary, for example :

NSString *myxml=@"< students od=\"ii\">< student>< name>Raju< /name>< age>25< /age>< address>abcd< /address>< /student>< /students>";
NSDictionary *dict = [XMLReader dictionaryForXMLString:myxml error:nil];

gives me an NSDictionary like:

students = 
{
    "@od" = ii;
    student = 
    {
        address = abcd;
        age = 25;
        name = Raju;
    };
};

I can perfectly extract any of these parameters except for the attributes. Can someone tell me how to get the value of 'od'?
Thanks.

EDIT : i resolved th problem,actually i had to create a new NSDictionary :
NSDictionary *str = [students valueForKey:@"@od"];


Solution

  • EDIT : i resolved th problem,actually i had to create a new NSDictionary :

    NSDictionary *str = [students valueForKey:@"@od"];