0
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
    xmlParseChunk(context, (const char *)[data bytes], [data length], 0);
}

my Question is as follows

=> didReceiveData: method receives data in parts

Some what like this

  • first data----------| <masterData>Main</ma
  • second data-----| ster><masterData>Main2
  • third data --------| </masterData>

=> How xmlParseChunk() method can parse all these chunks successfully?

4

2 回答 2

2

Apple's XMLPerformance sample app illustrates a complete implementation of libxml2 integrated with NSURLConnection and chunk parsing. I found it very helpful.

于 2009-10-28T21:17:06.803 回答
0

One approach is to have your delegate contain an NSMutableData member and invoke appendData: when you get new data. Then parse it when your delegate gets the connectionDidFinishLoading message.

于 2009-10-28T20:12:05.997 回答