나는 다음과 같은 XML 파일이 있습니다NSXML 파서
<?xml version="1.0"? encoding="UTF-8"?>
<api>
<count count="55" />
<spa>
<opt>aa</opt>
<opt>bb</opt>
<opt>cc</opt>
</spa>
</api>
M 다음 줄의 코드 사용 : "오류 오류 오류"로 출력을 받고 있어요, 그러나
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"space.xml"];
NSData *data = [[NSData alloc] initWithContentsOfFile:path];
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:data];
//Initialize the delegate.
XMLParser *theParser = [[XMLParser alloc] initXMLParser];
//Set delegate
[xmlParser setDelegate:theParser];
//Start parsing the XML file.
BOOL success = [xmlParser parse];
if(success)
NSLog(@"No Errors");
else
NSLog(@"Error Error Error!!!");
을 gdb에서. 나는 Objective C를 처음 접했고 오류를 극복 할 수 없었다. 누군가 도와 줄 수 있니? 감사.
ur 위임 초기화에서이'XMLParser'는 무엇입니까? –
XMLParser.h라는 파일이 있습니다. –
이 파일에는 뭐가 있습니까? 또한 XMLParser.m을 가지고 있습니까? *** naveen ***은 ur XMLParser.m 파일에 모든 코드 행이없는 경우에만 & u를 씁니다. –