iphone - NSXML parser : problem in parsing xml data -


i working on iphone application getting data server using php webservice , need show records in table view. going well, today compiled code , run in simulator , found data not parsing parser while received server xml. check tag name in xml , parsing delegate methods.

here xml data , tag name.

root>

row>

postid>6bf718dd-e91b-4f8e-8edb-520d66e02d60 /postid>

postdate>dec 1 2010 10:31pm /postdate>

post>resume on mywebsite /post>

firstname>testing /firstname>

lastname>team /lastname>

profileimage>http://mywebsite.com/upload_pic/thumbnail_%7b94808ec1-06df-4ac2-b1c3-21dc5108695c%7d.jpg /profileimage>

community>the park/community> noofcomments>0 /noofcomments> /row /root

static nsstring *kxmltagname_root = @"root";

static nsstring *kxmltagname_row = @"row";

static nsstring *kxmltagname_postid = @"postid";

static nsstring *kxmltagname_postdate = @"postdate";

static nsstring *kxmltagname_post = @"post";

static nsstring *kxmltagname_firstname = @"firstname";

static nsstring *kxmltagname_lastname = @"lastname";

static nsstring *kxmltagname_profileimage = @"profileimage";

static nsstring *kxmltagname_community = @"community";

static nsstring *kxmltagname_noofcomments = @"noofcomments";

-(void)parser:(nsxmlparser *)parser foundcharacters:(nsstring *)string {

if ([currentelement isequaltostring:kxmltagname_postid]) {

nslog(@"postid = %@",string); if(string) //[dictcommunityinfo setobject:string forkey:@"postid"]; [arrmainpostinfo addobject:string];

}

else if ([currentelement isequaltostring:kxmltagname_postdate]) {

nslog(@"postdate = %@",string); if(string) [arrmainpostinfo addobject:string];

}

else if ([currentelement isequaltostring:kxmltagname_post]) {

nslog(@"posted data = %@",string); //if(string) [arrmainpostinfo addobject:string];

}

else if ([currentelement isequaltostring:kxmltagname_firstname]) { nslog(@"fname=%@ ",string); if(string) [arrmainpostinfo addobject:string];

}

else if ([currentelement isequaltostring:kxmltagname_lastname]) {

nslog(@"lname=%@ ",string); if(string) [arrmainpostinfo addobject:string]; }

else if ([currentelement isequaltostring:kxmltagname_profileimage]) {

nslog(@"profileimageurl=%@ ",string); if(string) [arrmainpostinfo addobject:string]; }

else if ([currentelement isequaltostring:kxmltagname_community]) {

nslog(@"community=%@ ",string); if(string) [arrmainpostinfo addobject:string]; }

else if ([currentelement isequaltostring:kxmltagname_commentid]) {

nslog(@"commentid = %@",string); if(string) [dictcomentsinfo setobject:string forkey:@"commentid"];

}

else if ([currentelement isequaltostring:kxmltagname_commentpostdate]) {

nslog(@"commentpostdate = %@",string); if(string) [dictcomentsinfo setobject:string forkey:@"commentpostdate"];

}

else if ([currentelement isequaltostring:kxmltagname_commentpost]) {

nslog(@"commentpost data = %@",string); if(string) [dictcomentsinfo setobject:string forkey:@"commentpost"];

}

else if ([currentelement isequaltostring:kxmltagname_commentfirstname]) { nslog(@"commentfirstname=%@ ",string); if(string) [dictcomentsinfo setobject:string forkey:@"commentfirstname"];

}

else if ([currentelement isequaltostring:kxmltagname_commentlastname]) {

nslog(@"commentlastname=%@ ",string); if(string) [dictcomentsinfo setobject:string forkey:@"commentlastname"]; }

else if ([currentelement isequaltostring:kxmltagname_comentprofileimage]) {

nslog(@"commentprofileimage=%@ ",string); if(string) [dictcomentsinfo setobject:string forkey:@"commentprofileimage"]; }

else if ([currentelement isequaltostring:kxmltagname_usercommunity]) {

nslog(@"commentcommunity=%@ ",string); if(string) [dictcomentsinfo setobject:string forkey:@"commentcommunity"]; }

}

parser checking following 3 tag , leave other tags

if ([currentelement isequaltostring:kxmltagname_postid]) {

nslog(@"postid = %@",string); if(string) //[dictcommunityinfo setobject:string forkey:@"postid"]; [arrmainpostinfo addobject:string];

}

else if ([currentelement isequaltostring:kxmltagname_postdate]) {

nslog(@"postdate = %@",string); if(string) [arrmainpostinfo addobject:string];

}

else if ([currentelement isequaltostring:kxmltagname_post]) {

nslog(@"posted data = %@",string); //if(string) [arrmainpostinfo addobject:string];

}

any idea this, using xcode 3.2.1 chek on device 3gs same in that. socked code going fine before today re check web-service , xml tag name. please help

thanks,

i got solution. special character found in () thats why xml parser unable parse that, ignores other tag.

i change character , working.

thanks


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -