Skip to content Skip to sidebar Skip to footer

Html Parsing: How To Get Link Tag From Remote Site

I have a site (for example apple.com) which contain link tag, for example Copy

Apples documentation has some examples about how to further use and access the matches:

https://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSRegularExpression_Class/Reference/Reference.html

e.g. something like the following regex should do for the hrefs:

<link.*?href="(.*?)".*?>

Solution 2:

if you using jquery, $("link").attr("title") --> print "RSS" $("link").attr("href") --> print http://*

if you want to get the href content, using jquery ajax. $.get("http://*", function(result){});

Solution 3:

Create an NSXMLDocument using -initWithContentsOfURL:options:error: with the NSXMLDocumentTidyHTML option. Then, you can navigate the hierarchy of nodes starting with -rootElement. Or, you can use XPath, like [doc nodesForXPath:@"//link@title"].

Post a Comment for "Html Parsing: How To Get Link Tag From Remote Site"