Following is my code block:
NSArray *innerArrayOfItems = [dictionaryOfItems objectForKey:kXMLNodeChildArray];
NSString *key = [[NSString alloc] init];
NSString *value = [[NSString alloc] init];
for (NSDictionary *innerDictionaryOfItems in innerArrayOfItems)
{
NSArray *keyValueOfString = [innerDictionaryOfItems objectForKey:kXMLNodeChildArray];
for (NSDictionary *innerDictonaryOfkeyValueOfString in keyValueOfString)
{
if ([[innerDictonaryOfkeyValueOfString objectForKey:kXMLNodeName] isEqualToString:@"Key"])
{
key = [innerDictonaryOfkeyValueOfString objectForKey:kXMLNodeContent];
}
if ([[innerDictonaryOfkeyValueOfString objectForKey:kXMLNodeName] isEqualToString:@"Value"])
{
value = [innerDictonaryOfkeyValueOfString objectForKey:kXMLNodeChildArray];
NSArray *valueArray = [innerDictonaryOfkeyValueOfString objectForKey:kXMLNodeChildArray];
for (NSDictionary *valueDictionary in valueArray)
{
if ([[valueDictionary objectForKey:kXMLNodeName] isEqualToString:@"ItemTypeAlias"])
{
for (NSDictionary *entity_Key_ViewNameDictionary in theDelegate.entity_Key_ViewNameArray)
{
if ([[[entity_Key_ViewNameDictionary allValues] objectAtIndex:0]
isEqualToString:[valueDictionary objectForKey:kXMLNodeContent]])
{
[dataTableArrayDeleted addObject:[[entity_Key_ViewNameDictionary allKeys] objectAtIndex:0]];
break;
}
}
//Getting DataTable Primary Key column name
for (NSDictionary *tables_PrimaryKey_TableNameDictionary
in theDelegate.tables_PrimaryKey_TableNameArray)
{
if ([[[tables_PrimaryKey_TableNameDictionary allKeys] objectAtIndex:0]
isEqualToString:[dataTableArrayDeleted lastObject]])
{
[dataTableKeyColumnArrayDeleted
addObject:[[tables_PrimaryKey_TableNameDictionary allValues] objectAtIndex:0]];
isDataAvailabeleForSaveDelete = TRUE;
break;
}
}
}
}
}
}
[self saveGetDataUpdatesDeletedData:key :value];
}
The above code , look into the objects populated by xml parser and look inside each node from parent node to child nodes (conditional) ,
There is another block in xml which is the additional information of above xml node collection, after looking inside of above loop it will store all the found values to an object and later it comes to another block and search detail of the stored values.
Is there any other proper way of doing xml reading/parsing and storing values in variables?
Thanks, Imran Rizvi