NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
ns string * documents directory =【paths objectAtIndex:0】;
chat file =【【ns string alloc】init with string:【documents directory stringByAppendingPathComponent:chats file _ NAME】;
2.加載文件
-(void)load thread:(ns string *)xmlFile {
nsautorelaespool * pool =【【nsautorelaespool alloc】init】;
nsxml parser * chatLogParser =【【nsxml parser alloc】initwithcontentsourl:【NSURLfileURLWithPath:xmlFile】】;
【chatLogParser set delegate:self】;
【current string set string:@““】;//記錄當前節點的值
【currentChatInfo remove all objects】;//節點對象
【chatLogParser解析】;//開始XML解析
chatLogParser發布】;
【self performSelectorOnMainThread:@ selector(finshLoadFile)with object:nil waitildone:YES】;//創建線程
【池釋放】;
}