在我的 iOS 应用程序中,我尝试使用 NSXMLParser 解析以下 xml。我可以在 iOS5 中成功解析这个 xml,但在 iOS6 中解析器没有进入 parserdidStartElement 。在iOS6 parserDidStartDocument 被成功调用但没有进入任何其他解析器委托方法.. xml 格式有什么问题吗?我怎样才能解决这个问题..
<RESULTS>
<ROW>
<COLUMN NAME="NAME">Test1</COLUMN>
<COLUMN NAME="ANAME">testing xml1</COLUMN>
<COLUMN NAME="PHONE">4470111</COLUMN>
<COLUMN NAME="REMARKS"/>
<COLUMN NAME="XCOORD_DMS">227901.58873387</COLUMN>
<COLUMN NAME="YCOORD_DMS">391872.68493206</COLUMN>
<COLUMN NAME="XCOORD_WGS">51.49367618</COLUMN>
<COLUMN NAME="YCOORD_WGS">25.27912682</COLUMN>
</ROW>
<ROW>
<COLUMN NAME="NAME">Test2</COLUMN>
<COLUMN NAME="ANAME">testing xml2</COLUMN>
<COLUMN NAME="PHONE">4258444</COLUMN>
<COLUMN NAME="REMARKS"/>
<COLUMN NAME="XCOORD_DMS">229608.71442946</COLUMN>
<COLUMN NAME="YCOORD_DMS">386848.18818915</COLUMN>
<COLUMN NAME="XCOORD_WGS">51.51051535</COLUMN>
<COLUMN NAME="YCOORD_WGS">25.23373805</COLUMN>
</ROW>
</RESULTS>
这是代码..
- (void) initView:(JsonObject *) pageMenu{
appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSURL* url = [NSURL URLWithString:@"http://www.test.in/test.xml"];
NSXMLParser* parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[parser setDelegate:self];
[parser parse];
[parser release];
}
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName
attributes:(NSDictionary *)attributeDict{
NSLog (@"I have started");
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName{
NSLog (@"I have started");
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
NSLog (@"I have started");
}
-(void) parserDidStartDocument:(NSXMLParser *)parser {
NSLog (@"I have started");
}
-(void) parserDidEndDocument: (NSXMLParser *)parser {
NSLog (@"I have started");
}