CDATA Parsing Values

I am parsing CDATA but i am gettings the values... http://nikelebron.net/feed/ and http://www.nicekicks.com/feed/ in this both rss feeds i want get src value in tag

- (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock
{
 NSString *someString = [[NSString alloc] initWithData:CDATABlock  
                                          encoding:NSUTF8StringEncoding];
}

Answers


This code will print all the jpg image links in the CDATA,

-(void) parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock{
    NSString *cDataString = [[NSString alloc] initWithData:CDATABlock encoding:NSUTF8StringEncoding];
    NSDataDetector *detect = [[NSDataDetector alloc] initWithTypes:NSTextCheckingTypeLink error:nil];
    NSArray *matches = [detect matchesInString:cDataString options:0 range:NSMakeRange(0, [cDataString length])];

    for(int i=0; i<matches.count;i++){
      NSTextCheckingResult *result = [matches objectAtIndex:i];
      NSString *linkUrl = [result URL].absoluteString;


      if([[linkUrl pathExtension] isEqualToString:@"jpg"]){
      //for your requirement, change the above line to
      //NSString *pathExtension = [linkUrl pathExtension];
      //if((pathExtension.length>=3)&&([[pathExtension substringToIndex:3] isEqualToString:@"jpg"])){
       NSLog(@"image link:%@", linkUrl);
      }else NSLog(@"link:%@", linkUrl);

    }
}

Need Your Help

Version of Oracle thin driver to use with Java 6

oracle jdbc oracle10g jdk1.6 java-ee-5

We are upgrading from Java 1.5 to Java 6 and J2EE 1.4 to Java EE 5. We are using Oracle 10g. Java EE 5 only supports JDBC 3.0, but Java 6 supports JDBC 4.0. If I am running on a Java EE 5 server with

Why does my datagridview repositions on escape

c# datagridview

I have a DataGridView control on a form in a manged c# project. (.net 2.0)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.