こんにちは、Web サービスの応答から取得したデータで NSXMLparser を初期化しようとすると、何も取得されません (nil 値)。これは私が使用するコードです。
header.h
NSData*abccc;
NSMutableData*conWebMutableData;
NSXMLParser*xmlParser;
@interface ResponseWebServices_View : UIViewController<NSStreamDelegate, NSXMLParserDelegate>
@property(nonatomic,strong)NSMutableString*soapResults;
@property(nonatomic,strong)NSXMLParser*xmlParser;
@property(nonatomic, strong)NSData*abcc;
@end
file.m
-(void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response{
[conWebMutableData setLength:0];
}
-(void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)data{
[conWebMutableData appendData:data];
}
-(void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error{
NSLog(@"ERROR with con");
}
-(void)connectionDidFinishLoading:(NSURLConnection*)connection{
NSString*theXML = [[NSString alloc]initWithBytes: [conWebMutableData mutableBytes] length:[conWebMutableData length]encoding:NSUTF8StringEncoding];
NSLog(theXML);
abccc= [theXML dataUsingEncoding:NSUTF8StringEncoding];
//xmlParser = [[NSXMLParser alloc]initWithData:conWebMutableData]; (0x00000000)xmlParser value i get
//xmlParser = [[NSXMLParser alloc]initWithData:abccc]; (0x00000000)xmlParser value
[xmlParser setDelegate:self ];
[xmlParser setShouldResolveExternalEntities: YES];
[xmlParser parse];
}