Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i load a TableView with a NSMutableArray that contains NSMutableDictionary Object?
    primarykey
    data
    text
    <h2>I am parsing xml file and adding the attribute values in a NSMutableArray as follows :</h2> <pre><code>-(NSMutableArray *) ReadXml { NSError *error=[[NSError alloc] init]; CXMLDocument *doc=[[CXMLDocument alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://socialcubebd.com/pandit/questions.xml"] options:0 error:&amp;error]; if (error==nil) { //CXMLDocument *doc=[[CXMLDocument alloc] init]; //doc=[self ReadXml]; NSMutableArray *questionsWithQuestionDictionary = [[NSMutableArray alloc] init]; // we will put parsed data in an a array NSArray *nodes = NULL; // searching for question nodes nodes = [doc nodesForXPath:@"//question" error:nil]; NSMutableDictionary *question ; for (CXMLElement *node in nodes) { question= [[NSMutableDictionary alloc] init]; int counter; for(counter = 0; counter &lt; [node childCount]; counter++) { // common procedure: dictionary with keys/values from XML node [question setObject:[[node childAtIndex:counter] stringValue] forKey:[[node childAtIndex:counter] name]]; } // and here it is - attributeForName! Simple as that. [question setObject:[[node attributeForName:@"number"] stringValue] forKey:@"number"]; [question setObject:[[node attributeForName:@"question"] stringValue] forKey:@"question"]; [question setObject:[[node attributeForName:@"questionImage"] stringValue] forKey:@"questionImage"]; [question setObject:[[node attributeForName:@"option4"] stringValue] forKey:@"option4"]; [question setObject:[[node attributeForName:@"option1"] stringValue] forKey:@"option1"]; [question setObject:[[node attributeForName:@"option2"] stringValue] forKey:@"option2"]; [question setObject:[[node attributeForName:@"option3"] stringValue] forKey:@"option3"]; [questionsWithQuestionDictionary addObject:question]; [question release]; } return questionsWithQuestionDictionary; } else { return 0; } } </code></pre> <p>//---------------------------------------</p> <h2>Resulting NSMutableArray with NSMutableDictionary is Like :</h2> <pre><code>2011-04-15 18:11:22.647 SC.Pandit[983:207] ( { number = 1; option1 = "Richard Marx"; option2 = "Bon Jovi"; option3 = "Bryan Adams"; option4 = "None of them"; question = "Who is he ?"; questionImage = "http://photographerscube.com/MediumSizePhoto/medium_1.jpg"; }, { number = 2; option1 = USA; option2 = UAE; option3 = UK; option4 = Spain; question = "Which countries currency known as \U2018Pound\U2019?"; questionImage = "http://photographerscube.com/MediumSizePhoto/medium_2.jpg"; }, { number = 3; option1 = Taka; option2 = Rupee; option3 = "Austral "; option4 = Dollar; question = "What is the name of the currency of Argentina?"; questionImage = "http://photographerscube.com/MediumSizePhoto/medium_3.jpg"; }, { number = 4; option1 = Euro; option2 = Dirham; option3 = Dinar; option4 = Dollar; question = "Identify the currency name from the picture-"; questionImage = "http://photographerscube.com/MediumSizePhoto/medium_4.jpg"; }, { number = 5; option1 = Sweden; option2 = Qatar; option3 = "Bangladesh "; option4 = Egypt; question = "Krona\U2019 is the name of currency of \U2013"; questionImage = "http://photographerscube.com/MediumSizePhoto/medium_5.jpg"; } ) </code></pre> <p>///////////////////////////////////////////////////</p> <p>Now i want to Load my tableView with every single dictionary dictionary separately.Can anyone help me on this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload