这是我的视图控制器代码的样子,我很困惑为什么我会收到错误。任何有关这方面的帮助将非常感谢!谢谢!
import UIKit
import Kanna
let url = NSURL (string: "my website")
let data = NSData (contentsOfURL: url!)
let doc = HTML (html: data !, encoding: NSUTF8StringEncoding)
let doc = Kanna.HTML(url: (NSURL(string: "the_site_url")!), encoding: NSUTF8StringEncoding) {
// Search for nodes by XPath
for link in doc.xpath("//*[@id="hp-content"]/div[3]") {
print(link.text)
print(link["href"])
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
] }
}