Q:

Read text file and get components iPhone Objective-C

I have a text file that currently looks like this: 
<joke>What do you call an Italian man with one toe?</joke>
<answer>Roberto!!</answer>
<joke>What is the best time to go to the dentist? </joke>
<answer>2:30 (Tooth Hurty)!!</answer>
<joke>Why was the doctor mad?</joke>
<answer>Because he had no patients!!</answer>

I just wanted to know how I can get the text inbetween the <joke> and the </joke> parts and then put them into an array.

A:

 NSArray *chunks = [jokertf componentsSeparatedByString:@"<joke>"];
 for (int i = 0; i < [chunks count]; i++) {
  NSString *c = [chunks objectAtIndex:i];
  NSArray *c2 = [c componentsSeparatedByString:@"</joke>"];

  NSArray *aChunks = [jokertf componentsSeparatedByString:@"<answer>"];
  NSString *a = [aChunks objectAtIndex:i];
  NSArray *a2 = [a componentsSeparatedByString:@"</answer>"];
 }

