Search code examples
objective-cioshtml-parsinghpple

hpple parser string length issue


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 :)


Solution

  • ok. i tested html include html tags.

     < extdata_pass2phone />
    so i made this problem. sorry.