I am parsing an xml file with three of the same elements: “im:imageLink”. Currently I am adding all three links to an array:
if ([currentElement isEqualToString:@"im:image"]) {
string = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[imageLinks addObject:string];
}
I would really appreciate it if you could tell me how I could separate each of the three elements, and put them in three different arrays.
If I understand the comments above, you want to separate the items by the height attribute, which seems to come in 3 known values: 55, 60, and 170. In this case, you could split them based on the attribute dictionary passed in to the parser:didStartElement:… call. Presuming you called the attributes variable “attributeDict”, your call would look something like:
From there you can use a typical if…then…else construction to stuff the results into the three different arrays. Like: