Note that there are some explanatory texts on larger screens.

plurals
  1. PONSXML Parser: Cdata block not getting through NSString Return
    primarykey
    data
    text
    <p>I'm having a problem with an ios rss reader app. </p> <p>I'm pulling in an RSS feed from feedburner and most of that data work nicely within the app as is, all but the Cdata block anyway. After some googling, I came up with what you see below. It is supposed to pull in the cdata, move it into an nsstring, strip the HTML out, and return the string. </p> <p>The problem is the "(void)parser" works fine, but the "(NSString)stringbystrippinghtml" does not. Every time I run it, it removes all the data, it doesn't even return my "NSlog Return S" value as Null. At this point I'm not sure what to do. </p> <p>Any ideas?</p> <pre><code>- (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock{ // http://stackoverflow.com/questions/3485190/nsstring-initwithdata-returns-null NSString *cData = [[NSString alloc] initWithData:CDATABlock encoding:NSUTF8StringEncoding]; // NSLog(@"CDATA PARSER: %@", cData); // self.currentItem.story = cData; [self stringByStrippingHTML:cData]; } -(NSString *) stringByStrippingHTML:(NSString *)cData { // http://stackoverflow.com/questions/277055/remove-html-tags-from-an-nsstring-on-the-iphone // NSLog(@"CDATA PARSER: %@", cData); NSRange r; NSString *s = cData; NSLog(@"Beginning S Value: %@", s); while ((r = [s rangeOfString:@"&lt;[^&gt;]+&gt;" options:NSRegularExpressionSearch]).location != NSNotFound) s = [s stringByReplacingCharactersInRange:r withString:@""]; return s; NSLog(@"Returned S Value: %@", s); self.currentItem.story = s; } </code></pre> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload