2011-08-02 60 views

回答

2

您需要實現符合NSXMLParserDelegate協議的NSXMLParser的代理。在此實現中至少實現此方法:

-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName 
             namespaceURI:(NSString *)namespaceURI 
             qualifiedName:(NSString *)qualifiedName 
             attributes:(NSDictionary *)attributeDict 
{ 
    if ([elementName isEqualToString:@"link"]) { 
     NSString* href = [attributeDict objectForKey:@"href"]; 
     // Do you stuff with the href 
    } 
} 
相關問題