xml parsing link has sub tag link,in link there description , images , title.i want description part wrote code that
- (void)loadingdescription { nserror *error=nil; //* goshipsurl has link , send nsdata* nsdata *gossipshtmldata=[nsdata datawithcontentsofurl: gossipsurl options:nsdatareadinguncached error:&error]; // using nserrer 1 error,we need find out gives no exceptions , nil value if (error) { nslog(@"%@",[error localizeddescription]); } else { nslog(@"loading successfully"); } tfhpple *gossipsparser = [tfhpple hpplewithhtmldata:gossipshtmldata]; nsstring *gossipsxpathquerystring = @"//p//text()"; nslog(@"%@",gossipsparser);//it has object descriptiongossipsnodes = [gossipsparser searchwithxpathquery:gossipsxpathquerystring]; //in descriptiongossipsnodes has 6 objects if ([descriptiongossipsnodes count] > 0) { [self.emailbutton setenabled:yes]; [self.twitterbutton setenabled:yes]; [self.facebookbutton setenabled:yes]; [scrollview sethidden:no]; nsmutablearray *temparray = [nsmutablearray array]; (tfhppleelement *element in descriptiongossipsnodes) { [temparray addobject:[element content]]; } //in temparary array has <__nsarraym 0x7f87e8dd1820>( , contact us, , privacy, © 2015,) content. nsstring *result = [temparray componentsjoinedbystring:@""]; self.textview.text = result; } else { [self.emailbutton setenabled:no]; [self.twitterbutton setenabled:no]; [self.facebookbutton setenabled:no]; [scrollview sethidden:yes]; uialertview *alert =[[uialertview alloc]initwithtitle:@"connection failed" message:nil delegate:self cancelbuttontitle:@"ok" otherbuttontitles: nil]; [alert show]; } }
so how can solve explained code in comments please me.
Comments
Post a Comment