开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜