- (void)xmlDataTaskGet
{
NSString *strUrl=@"http://192.168.0.124:8080/WYServer/video?type=XML";
NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:strUrl]];
NSURLSession *session=[NSURLSession sharedSession];
NSURLSessionDataTask *dataTask=[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
GDataXMLDocument *doc=[[GDataXMLDocument alloc] initWithData:data options:0 error:nil];
GDataXMLElement *root=doc.rootElement;
for (GDataXMLElement *e in root.children) {
NSLog(@"%@ %@ %@ %@ %@ ",
[e attributeForName:@"id"].stringValue,
[e attributeForName:@"name"].stringValue,
[e attributeForName:@"length"].stringValue,
[e attributeForName:@"image"].stringValue,
[e attributeForName:@"url"].stringValue
);
}
}];
[dataTask resume];
}