NSXMLParser can not get the content of elements correctly

后端 未结 2 691
再見小時候
再見小時候 2021-01-24 02:50

i have the following XMLParser but when i try to run it, it doesn\'t work properly.

- (void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementname         


        
相关标签:
2条回答
  • 2021-01-24 03:27

    I used the following code and works now:

    - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
    
         if(!elementContentString) 
         elementContentString = [[NSMutableString alloc] initWithString:string]; 
         else 
        [elementContentString appendString:string];
    }
    
    0 讨论(0)
  • 2021-01-24 03:39

    I don't think there any problem in your code, it is working fine at my end. I am using the twitter api for getting xml and it is giving me proper output.

    0 讨论(0)
提交回复
热议问题