I an following THIS tutorial and everything works fine but I want to modified that in my application. In my app I want to remove some HTML tag from my HTML view for that I save the whole HTML code of the webPage into a string now I want to modify that string like I want to remove some tags from It but I don't have any Idea that how can I remove some specific tags from that string and I have following code from that tutorial:
func loadTutorials(){
var tutorialsUrl : NSURL = NSURL(string: "https://developer.apple.com/library/mac/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-XID_467")!
var tutorialsHtmlData : NSData = NSData(contentsOfURL: tutorialsUrl)!
var string = NSString(data: tutorialsHtmlData, encoding: NSUTF8StringEncoding)
println(string!)
// var tutorialsParser : TFHpple = TFHpple(HTMLData: tutorialsHtmlData)
//
// var tutorialsXpathQueryString:String = "//div[@class='content-wrapper']/p[@class='header-text']/a"
//
//
//
// var tutorialsNodes : Array = tutorialsParser.searchWithXPathQuery(tutorialsXpathQueryString)
//
// var newTutorials : NSMutableArray = NSMutableArray(capacity: 0)
//
// for element in tutorialsNodes as [TFHppleElement]{
//
// // 5
// var tutorial : Tutorial = Tutorial()
// newTutorials.addObject(tutorial)
//
// // 6
// tutorial.title = element.firstChild.content
//
// // 7
// tutorial.url = element.objectForKey("href")
// }
}
from this Link I want to remove below meta tags from the HTML:
<meta id="g-version" name="g-version" content="7fcbb0a2" />
<meta id="j-version" name="j-version" content="1.2.0" />
<meta id="build" name="build" content="60068c96635318099c2acaff2a2b2e00" />
<meta id="document-version" name="document-version" content="2.1.8" />
<meta id="book-assignments" name="book-assignments" content="{Type/Guide}, {Topic/Languages & Utilities/Swift}" />
<meta scheme="apple_ref" id="identifier" name="identifier" content="//apple_ref/doc/uid/TP40014097" />
<meta id="chapterId" name="chapterId" content="TP40014097-CH5">
<meta id="book-title" name="book-title" content="The Swift Programming Language" />
<meta id="book-resource-type" name="book-resource-type" content="Guide" />
<meta id="book-root" name="book-root" content="./" />
<meta id="book-json" name="book-json" content="book.json">
<meta id="date" name="date" content="2014-10-16" />
<meta id="description" name="description" content="The definitive guide to Swift, Apple’s new programming language for building iOS and OS X apps." />
<meta id="IndexTitle" name="IndexTitle" content="" />
<meta id="devcenter" name="devcenter" content="<!-- DEVCENTER_NAME -->" />
<meta id="devcenter-url" name="devcenter-url" content="<!-- DEVCENTER_URL -->" />
<meta id="reflib" name="reflib" content="<!-- REFLIB_NAME -->" />
<meta id="xcode-display" name="xcode-display" content="render" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, maximum-scale=1.0">
But I have no Idea that how can I achieve this.
Here is my source code.
I have asked question on It is posible to load customise HTML view into webView in swift? but This time I want to achieve this programatically.Any solution for this?