Reputation: 5507
I have table with data taken from NSDictionary. For example Each row of table contains Currency Name and rate which are linked using NSDictionary. Now i want to take rate value from XML file over the network. I have made XML file and web server.
Thanks in advance
Upvotes: 0
Views: 129
Reputation: 10393
After you parse your xml file, use the reference to your dictionary and do the following:
Assuming the xml will have <Currency> conversionrate </currency>
format. In your didendelement you can change the value of dictionary items as below:
- (void) parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
[dictionary setValue:parseditem forKey:elementName];
}
parsedItem can be got from the method :
- (void) parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
Here you have to take care that the element name has to be unique. You can also use attributes to do the same and add a if condition before adding it to the dictionary.
Upvotes: 1