topfunky / hpple

An XML/HTML parser for Objective-C, inspired by Hpricot.
http://topfunky.com
MIT License
2.77k stars 471 forks source link

content can not get #89

Closed OCAndSwift closed 6 years ago

OCAndSwift commented 6 years ago

"<a class="ke-insertfile" href="http://lonfile.5397078.cn/group1AABkuRGEBBM38.docx"

target="_blank">title- 13.docx"

I can not get the title of "title- 13.docx",why?

if let links = doc?.search(withXPathQuery: "//a") { for hppleElement in links { let model = hppleElement as! TFHppleElement print(model.content) // this is nil print(model.object(forKey: "href")) print(model.raw) let data2 = model.raw.data(using: .utf8) let doc2 = TFHpple.init(htmlData: data2) if let model2 = doc2?.peekAtSearch(withXPathQuery: "//a") { print(model2.content) // this is nil // titleArr.append(model2.content) } urlArr.append(model.object(forKey: "href")) } }