Is there an equivallent for NSXMLParserDelegate in the cocoa touch framework?
Like the title says, I want to parse XML in my iPhone application, but there is no NSXMLParserDelegate
protocol like there is in the System Foundation framework.开发者_C百科
Can I just add a reference to the /System/Library/Frameworks/Foundation.framework
in my iPhone application?
The NSXMLParser documentation shows the delegate methods available to you
Actually its ok, instead of implementing the NSXMLParserDelegate
you can just not implement it and define the require methods, like:
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
}
and it magically works :)
Also, a good library for parsing XML is TouchXml. I use it for parsing XML and its pretty easy to work with.
精彩评论