Note that there are some explanatory texts on larger screens.

plurals
  1. PONSXML parser : problem in parsing xml data
    primarykey
    data
    text
    <p>I am working on an iPhone application where I am getting data from server using php webservice and need to show records in table view. All was going well, but today i compiled code and run in simulator and found data is not parsing by parser while it is received from server as xml. I check the tag name in xml and parsing delegate methods.</p> <p>here is the xml data and tag name.</p> <p> <p>ROOT></p> <p>ROW></p> <p>PostID>6BF718DD-E91B-4F8E-8EDB-520D66E02D60 /PostID></p> <p>PostDate>Dec 1 2010 10:31PM /PostDate></p> <p>Post>resume on mywebsite /Post></p> <p>FirstName>Testing /FirstName></p> <p>LastName>Team /LastName></p> <p>ProfileImage>http://mywebsite.com/upload_pic/thumbnail_%7B94808EC1-06DF-4AC2-B1C3-21DC5108695C%7D.jpg /ProfileImage></p> <p>Community>the park/Community> NoOfComments>0 /NoOfComments> /ROW /ROOT </p> <p>static NSString *kXMLtagName_ROOT = @"ROOT";</p> <p>static NSString *kXMLtagName_Row = @"ROW";</p> <p>static NSString *kXMLtagName_PostID = @"PostID";</p> <p>static NSString *kXMLtagName_PostDate = @"PostDate";</p> <p>static NSString *kXMLtagName_Post = @"Post";</p> <p>static NSString *kXMLtagName_FirstName = @"FirstName";</p> <p>static NSString *kXMLtagName_LastName = @"LastName";</p> <p>static NSString *kXMLtagName_ProfileImage = @"ProfileImage";</p> <p>static NSString *kXMLtagName_Community = @"Community";</p> <p>static NSString *kXMLtagName_NoOfComments = @"NoOfComments";</p> <p>-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {</p> <p>if ([currentElement isEqualToString:kXMLtagName_PostID]) {</p> <p>NSLog(@"postid = %@",string); if(string) //[dictCommunityInfo setObject:string forKey:@"PostID"]; [arrMainPostInfo addObject:string];</p> <p>}</p> <p>else if ([currentElement isEqualToString:kXMLtagName_PostDate]) {</p> <p>NSLog(@"PostDate = %@",string); if(string) [arrMainPostInfo addObject:string];</p> <p>}</p> <p>else if ([currentElement isEqualToString:kXMLtagName_Post]) {</p> <p>NSLog(@"Posted data = %@",string); //if(string) [arrMainPostInfo addObject:string];</p> <p>}</p> <p>else if ([currentElement isEqualToString:kXMLtagName_FirstName]) { NSLog(@"fName=%@ ",string); if(string) [arrMainPostInfo addObject:string];</p> <p>}</p> <p>else if ([currentElement isEqualToString:kXMLtagName_LastName]) {</p> <p>NSLog(@"lName=%@ ",string); if(string) [arrMainPostInfo addObject:string]; }</p> <p>else if ([currentElement isEqualToString:kXMLtagName_ProfileImage]) {</p> <p>NSLog(@"ProfileImageUrl=%@ ",string); if(string) [arrMainPostInfo addObject:string]; }</p> <p>else if ([currentElement isEqualToString:kXMLtagName_Community]) {</p> <p>NSLog(@"Community=%@ ",string); if(string) [arrMainPostInfo addObject:string]; }</p> <p>else if ([currentElement isEqualToString:kXMLtagName_CommentID]) {</p> <p>NSLog(@"CommentID = %@",string); if(string) [dictComentsInfo setObject:string forKey:@"CommentID"];</p> <p>}</p> <p>else if ([currentElement isEqualToString:kXMLtagName_CommentPostDate]) {</p> <p>NSLog(@"CommentPostDate = %@",string); if(string) [dictComentsInfo setObject:string forKey:@"CommentPostDate"];</p> <p>}</p> <p>else if ([currentElement isEqualToString:kXMLtagName_CommentPost]) {</p> <p>NSLog(@"CommentPost data = %@",string); if(string) [dictComentsInfo setObject:string forKey:@"CommentPost"];</p> <p>}</p> <p>else if ([currentElement isEqualToString:kXMLtagName_CommentFirstName]) { NSLog(@"CommentFirstName=%@ ",string); if(string) [dictComentsInfo setObject:string forKey:@"CommentFirstName"];</p> <p>}</p> <p>else if ([currentElement isEqualToString:kXMLtagName_CommentLastName]) {</p> <p>NSLog(@"CommentLastName=%@ ",string); if(string) [dictComentsInfo setObject:string forKey:@"CommentLastName"]; }</p> <p>else if ([currentElement isEqualToString:kXMLtagName_ComentProfileImage]) {</p> <p>NSLog(@"CommentProfileImage=%@ ",string); if(string) [dictComentsInfo setObject:string forKey:@"CommentProfileImage"]; }</p> <p>else if ([currentElement isEqualToString:kXMLtagName_UserCommunity]) {</p> <p>NSLog(@"CommentCommunity=%@ ",string); if(string) [dictComentsInfo setObject:string forKey:@"CommentCommunity"]; }</p> <p>}</p> <p>parser is checking only following three tag and leave other all tags</p> <p>if ([currentElement isEqualToString:kXMLtagName_PostID]) {</p> <p>NSLog(@"postid = %@",string); if(string) //[dictCommunityInfo setObject:string forKey:@"PostID"]; [arrMainPostInfo addObject:string];</p> <p>}</p> <p>else if ([currentElement isEqualToString:kXMLtagName_PostDate]) {</p> <p>NSLog(@"PostDate = %@",string); if(string) [arrMainPostInfo addObject:string];</p> <p>}</p> <p>else if ([currentElement isEqualToString:kXMLtagName_Post]) {</p> <p>NSLog(@"Posted data = %@",string); //if(string) [arrMainPostInfo addObject:string];</p> <p>}</p> <p>Any Idea about this, I am using xcode 3.2.1 even i chek on device 3gs same in that. I am socked that all the code was going fine before today I re check the web-service and xml tag name. Please help</p> <p>Thanks,</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload