You said:
when i tried to use keys i found that solution not working, because each element contain 5 keys, for example i want single element with key "url", which further have key "prev", and also want only one object with that parameters
You could accomplish that with something like:
if ([elementName isEqualToString:@"image"])
{
NSString *name = attributDict[@"name"];
if ([name isEqualToString:@"prev"] && self.imageURLString == nil)
{
NSString *urlString = attributeDict[@"url"];
if (urlString)
{
self.imageURLString = urlString;
}
}
}
Elsewhere, though, you said:
When i can easy find corresponding text or description tag, i can't find proper image, because there is a lot of them. I want to get an image with proper width/height (one from 30), and then save it and move further ...
You'd have to describe what rules you want to apply to determine the "proper width/height". You could probably just want to have the parser save each of the image
the whole attributeDict
:
if ([elementName isEqualToString:@"image"])
{
[self.listOfImages addObject:attributeDict];
}
You could then, when you're done parsing all of the images
, iterate through all of these and identify which is "best" and prune the rest away if you want. You could also do this as you're parsing (e.g. save the attributeDict
of the "best image thus far", and every time you parse a new one, see if the dimensions are better, and if so, replace the "best image" with the current one).
But without knowing the precise rules you want to apply, it's hard to be more specific than that.