I'm using TouchXML to parse information from a video game site, and reading in an \[code\]<image>\[/code\] tag successfully. Some games don't have an image tag, and those are currently crashing my app. I'm trying to work out how I'd add some security to see whether or not the \[code\]<image>\[/code\] tag actually exists. The call I use is:\[code\]NSArray *imageList = [self getAllItems"//image" fileName:[NSURL URLWithString:queryURL]];\[/code\]And the \[code\]getAllItems\[/code\] method is as follows:\[code\]- (NSMutableArray *)getAllItemsNSString *)xpath fileNameNSURL *)file { NSMutableArray *res = [[NSMutableArray alloc] init]; NSData *XMLData = http://stackoverflow.com/questions/12749828/[NSData dataWithContentsOfURL:file]; CXMLDocument *doc = [[CXMLDocument alloc] initWithData:XMLData options:0 error:nil]; NSArray *nodes = NULL; nodes = [doc nodesForXPath:xpath error:nil]; for (CXMLElement *node in nodes) { NSMutableDictionary *item = [[NSMutableDictionary alloc] init]; int counter; for(counter = 0; counter < [node childCount]; counter++) { //ignore whitespace NSString *value = [[[node childAtIndex:counter] stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; if ([value length] != 0) // common procedure: dictionary with keys/values from XML node [item setObject:[[node childAtIndex:counter] stringValue] forKey:[[node childAtIndex:counter] name]]; } [res addObject:item]; } return res;}\[/code\]How could I add such validation? I'm not too confident using TouchXML, I've gotten it working but I've not needed to dig into this \[code\]getAllItems\[/code\] method yet. Thanks in advance!