I process the web server URLs and save them in Strings, and then display them in Webview. But now that I am parsing Spanish words, for example
http://litofinter.es.milfoil.arvixe.com/litofinter/PDF/Presentación_LITOFINTER_(ES).pdf
he takes it
PDF File Name ++++++ http://litofinter.es.milfoil.arvixe.com/litofinter/PDF/Presentaci
PDF File Name ++++++ ón_LITOFINTER_(ES).pdf
ie two different lines ... I know that I need to make a small change that adds a line, but I can not do it now, can anyone help me. Here is my code: -
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
currentElement = elementName;
if([currentElement isEqualToString:@"category"]) {
NSLog(@"Current element in Category:- %@",currentElement);
obj = [[Litofinter alloc]init];
obj.productsArray = [[NSMutableArray alloc]init];
}
if([currentElement isEqualToString:@"Product"]) {
obj.oneObj = [[Products alloc]init];
}
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
if([currentElement isEqualToString:@"Logo"]) {
obj.cLogo=[NSString stringWithFormat:@"%@",string];
NSLog(@"Logo to be saved in Array :- %@",obj.cLogo);
}
if([currentElement isEqualToString:@"Name"]) {
obj.cName=[NSString stringWithFormat:@"%@",string];
NSLog(@"Name to be saved in Array :- %@",string);
}
if([currentElement isEqualToString:@"cid"]) {
obj.cId=(int)[NSString stringWithFormat:@"%@",string];
NSLog(@"CID to be saved in Array :- %@",string);
}
if([currentElement isEqualToString:@"pid"]) {
obj.oneObj.id = (int)[oneBook.id intValue];
}
if([currentElement isEqualToString:@"Title"]) {
obj.oneObj.title = [NSString stringWithFormat:@"%@",string];
}
if([currentElement isEqualToString:@"Thumbnail"]) {
obj.oneObj.thumbnail= [NSString stringWithFormat:@"%@",string];
}
if([currentElement isEqualToString:@"pdf"]) {
obj.oneObj.pdf = [NSString stringWithFormat:@"%@",string];
NSLog(@"PDF File Name ++++++ %@",string);
}
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
if([elementName isEqualToString:@"category"]) {
NSLog(@"Current element in End Element Category:- %@",currentElement);
[TableMutableArray addObject:obj];
}
if([elementName isEqualToString:@"Product"]) {
[obj.productsArray addObject:obj.oneObj];
}
currentElement = @"";
}
I will be grateful to you.
source
share