25 February 2010

XMLPerformance Test App Extended For 3rd Party Libraries

XMLPerformance Test App Extended For 3rd Party Libraries


Category:

2 Comments

  1. alekhya (2 comments) says:

    Im using xml parsing post data in my iphone app.Im trying to implement login page.I used the following coding but eventhough im giving correct Email &Password,its not working.and my app has no errors..please please help me

    - (NSString *) postData: (NSString *) postString{
    NSLog(@”poststring:%@”,postString);
    NSURL *url=[NSURL URLWithString:@"http://www.myappdemo.com/sharefolio/login.php"];

    NSData *postData = [postString dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];

    NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];

    NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
    [request setURL:url];
    [request setHTTPMethod:@"POST"];
    [request setValue:postLength forHTTPHeaderField:@"Content-length"];
    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    //[request setValue:@"text/plain" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:postData];

    /* when we user https, we need to allow any HTTPS cerificates, so add the one line code,to tell teh NSURLRequest to accept any https certificate, i’m not sure about the security aspects */

    //[NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[url host]];

    NSError *error;
    NSHTTPURLResponse *response;
    NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

    NSString *data=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
    NSLog(@”%@”,data);

    //parsing start
    NSXMLParser *xmlParser=[[NSXMLParser alloc] initWithData:urlData];

    //initialize delegate
    StatusXMLParser *parser=[[StatusXMLParser alloc] initStatusXMLParser];

    //set delegate
    [xmlParser setDelegate:parser];

    //start parsing file
    BOOL success=[xmlParser parse];

    if(success){
    NSLog(@”user parsing No Errors”);
    }
    else{
    NSLog(@”Error”);

    }
    NSString *status=appDelegate.status;
    //NSLog(@”status:%@”,status);

    [parser release];
    [xmlParser release];

    [data release];
    return status;
    }

  2. alekhya (2 comments) says:

    Can u provide any samples for xml parsing through post data to create login page in my iphone application?

I'd love to hear your thoughts!