Share on Google+Share on Google+

Ravi Vora
0 Answer(s)      4 years and 11 months ago
Posted in : XML

    Arr_Lat=[[NSMutableArray alloc] init];
    Arr_title=[[NSMutableArray alloc] init];
    Arr_address=[[NSMutableArray alloc]init];
    Arr_Long=[[NSMutableArray alloc]init];

    NSString *urlString = [NSString stringWithFormat:@"",strSearch];
    NSError *error=nil;
    NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString] encoding:NSUTF8StringEncoding error:&error];
    NSArray *listItems = [locationString componentsSeparatedByString:@","];

    if([listItems count] >= 4 && [[listItems objectAtIndex:0] isEqualToString:@"200"])
        latitude = [[listItems objectAtIndex:2] doubleValue];
        longitude = [[listItems objectAtIndex:3] doubleValue];

    NSURL *url1 = [NSURL URLWithString:[NSString stringWithFormat:@",%f&radius=1000&output=json", latitude,longitude]];

    NSURLRequest *request2 = [NSURLRequest requestWithURL:url1];

    NSData *responseDataValue2 = [NSURLConnection sendSynchronousRequest:request2 returningResponse:nil error:nil];

    NSString *jsonString2 = [[NSString alloc] initWithData:responseDataValue2 encoding:NSUTF8StringEncoding];

    NSDictionary *main=[jsonString2 JSONValue];

    NSLog(@"main dic--%@",main);

    Arr_title = [[[main valueForKey:@"responseData"] valueForKey:@"results"]valueForKey:@"titleNoFormatting"];
    Arr_address=[[[main valueForKey:@"responseData"]valueForKey:@"results"]valueForKey:@"addressLines"];
    Arr_Lat=[[[main valueForKey:@"responseData"]valueForKey:@"results"]valueForKey:@"lat"];
    Arr_Long=[[[main valueForKey:@"responseData"]valueForKey:@"results"]valueForKey:@"lng"];

    [Arr_title retain];
    [Arr_address retain];
    [Arr_Lat retain];
    [Arr_Long retain];

    [tbl_place reloadData];


-(void)fireWebService { Arr_Lat=[[NSMutableArray alloc] init]; Arr_title=[[NSMutableArray alloc] init]; Arr_Long=[[NSMutableArray alloc]init]; Arr_address=[[NSMutableArray alloc]init];

NSString *urlString = [NSString stringWithFormat:@",%f&radius=100&output=json",appDel.curr_lat,appDel.curr_long];

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL


NSData *responseDataValue = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];

NSString *jsonString = [[[NSString alloc] initWithData:responseDataValue encoding:NSUTF8StringEncoding] autorelease];

NSDictionary *main = [jsonString JSONValue];

Arr_title = [[[[main valueForKey:@"responseData"]

valueForKey:@"results"]valueForKey:@"titleNoFormatting"] copy]; Arr_address=[[[[main valueForKey:@"responseData"]valueForKey:@"results"]valueForKey:@"addressLines"] copy]; Arr_Lat=[[[[main valueForKey:@"responseData"]valueForKey:@"results"]valueForKey:@"lat"] copy]; Arr_Long=[[[[main valueForKey:@"responseData"]valueForKey:@"results"]valueForKey:@"lng"] copy];

[Arr_title retain];

[tbl_nearplace reloadData];



View Answers

Related Tutorials/Questions & Answers:
?q=%@&output=csv",strSearch]; NSError *error=nil; NSString...?v=1.0&q=atm&rsz=8&sll=%f,%f&radius=1000&output=json...://,%f&
Java Spring Hibernate Struts Training were to start with xml, XSD and java write a program that Implement an integrated COM client server to add two visuall studio 2010 Building a Parent Child relationship XML how i connect two page xml question struts cfg file for DispatchAction with mysql db Creating custom output using XMLUnit - MatchTracker duplicates the output data Related to XML Related to XML Reading child of child nodes in xml Reading multiple xml files Spliting Large XML and one by one Moved to Output Folder XMl and Java web services project download xml file from website using java code Download how to create an xml file in following clear format Conditional increment in xslt Conditional increment in xslt Conditional increment in xslt HOW TO STORE MULTIPLE EMPLOYEE DETAILS TO XML FILE USING JSP? xml and servlets xml and servlets Question about parsing XML document with DOM in JAVA. Removal of XML header Converting PHP page with flash to JSP page without flash saving data in xml Doubt about Xstream Converter Reading xml file using dom parser in java with out using getelementby tag name xml dynamically how to change attiribute values in xml XML Schema xml xml sax parser for xml parsing xml using sax xml to html via java i want java code for this xml file...please show me.. SAX Parser for huge XML file xml parsing "opening video data error" in j2me XML to JSP mapview1 mapview searchbar searchbar jsonparsing xmlparsing retrieve multiple attribute values retrieve multiple attribute values


Advertisement null