Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If its a valid XML (from the example you showed us it is valid XML) you can Parse using NSXMLParser.</p> <pre><code>- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ if(!currentString){ currentString = [[NSMutableString alloc] init]; } [currentString appendString:string]; } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if([elementName isEqualToString:@"a"]){ NSLog(@"Text betweeen \"a\" tag %@",currentString); } [currentString release],currentString =nil; } </code></pre> <p>To get 0 from seekVideo(0), use </p> <pre><code>- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict{ if([elementName isEqualToString:@"a"]){ NSString* onClickAttribString = [attributeDict objectForKey:@"onclick"]; NSLog(@"OnClick Attrib: %@",onClickAttribString); // seekVideo(0); return false; NSArray* arrayList = [onClickAttribString componentsSeparatedByString:@" "]; // gives array of string seperated by space NSLog(@"seekvideo %@",[arrayList objectAtIndex:0]); //Process seekvideo(0); to get number... use NSScanner NSString* seekVideoString = [arrayList objectAtIndex:0]; NSString* numberString = [seekVideoString stringByTrimmingCharactersInSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]; NSLog(@"Number : %@",numberString); // if you want numberString converted to integer then [numberString intValue] } } </code></pre>
 

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