Guest User

Untitled

a guest
Jan 26th, 2017
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
  2. {
  3. self.elementName = qName;
  4.  
  5. item=[[NSMutableDictionary alloc] init];
  6. title=[[NSMutableString alloc] init];
  7. link=[[NSMutableString alloc] init];
  8. description=[[NSMutableString alloc] init];
  9.  
  10. }
  11. - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
  12. {
  13. if (!self.elementName)
  14. return;
  15. if ([_elementName isEqualToString:@"string"])
  16. {
  17. [title appendString:string];
  18. }
  19. else if ([_elementName isEqualToString:@"Table"])
  20. {
  21. [link appendString:string];
  22. }
  23. else if ([_elementName isEqualToString:@"City"])
  24. {
  25. [description appendString:string];
  26. }
  27.  
  28. [self.outstring appendFormat:@"%@", string];
  29. }
  30.  
  31. - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
  32.  
  33. if ([elementName isEqualToString:@"Table"]) {
  34. //[articles addObject:[item copy]];
  35. NSLog(@"table >>");
  36. } else if([elementName isEqualToString:@"City"]){
  37. NSLog(@"city >>");
  38. // [item setObject:ElementValue forKey:elementName];
  39. }
  40. else{
  41. NSLog(@"other>>");
  42.  
  43.  
  44. }
  45.  
  46. }
Add Comment
Please, Sign In to add comment