Dheeraj Kaveti
Dheeraj Kaveti

Reputation: 319

How to get the attributes inside a tag in an html file on iOS?

Here is my link i want to extract the youtube videos out from the html at this URL

http://gdata.youtube.com/feeds/api/users/mizzoushape/uploads?orderby=updated

$<link rel ='alternate' href='somelink.html'/>$

Can any one help me out how to fetch the attributes inside the tag..

Thanks in advance for your valuable time

Upvotes: 0

Views: 844

Answers (1)

Deeps
Deeps

Reputation: 4577

If you are parsing XML File Then:

In the parser:didStartElement method, the attributes are stored in the attributeDict dictionary. The values are then stores with the attribute name as the key

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName  attributes:(NSDictionary *)attributeDict{

// Here you can get value from "attributeDict" by key for example
NSString *strHref = [attributeDict objectForKey:@"href"];

}

Upvotes: 1

Related Questions