0

There is a problem parsing the string.

i got the data from web server

HTML data is very long.and content of node is long too. almost 3000~4000 length. Characters long, there is a problem, in my opinion.

my code like this

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSString* aStr = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding]; 
    NSLog(@"%@", aStr); // It's ok

    TFHpple *xpathParser       = [[TFHpple alloc] initWithHTMLData:receivedData];
    NSArray *elementsTextData  = [xpathParser searchWithXPathQuery:@"/html/body/textdata_pass2phone"];
    TFHppleElement *element    = [elementsTextData objectAtIndex:0];
    NSLog(@"%@", element); // oops!! The string was cut.
}

I can not understand. why string was cut. please help me. I am very worried :(

ps. i change parser to HTMLParser. but the same problem. return null. short words are return No problem.

sorry i can't speak english very well. i am study english every day :)

realmasse
  • 523
  • 1
  • 6
  • 18
  • At the top of the method, write the data to a temp file in /tmp in the simulator, then post that to a drop box account and maybe someone like me can take a peek at it [aStr writeToFile:@"/tmp/foo.txt atomically:YES encoding: NSUTF8StringEncoding error:nil] – David H Sep 26 '12 at 18:26
  • ok. i am working now. when i go back home. i'll upload to a drop box. thank you :) – realmasse Sep 27 '12 at 01:25

1 Answers1

0

ok. i tested html include html tags.

 < extdata_pass2phone />
so i made this problem. sorry.
realmasse
  • 523
  • 1
  • 6
  • 18