Skip to content

ndavon/NDHpple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DESCRIPTION

NDHpple is a Swift wrapper on the XMLPathQuery library based on Hpple.

CREDITS

NDHpple was created by Nicolai Davidsson, based on Hpple by Geoffrey Grosenbach, Topfunky Corporation.

INSTALLATION

Build the package with the most recent Swift 2.2 Snapshot (as of January 28th) with this command:

swift build -Xcc -I/usr/include/libxml2 -c release

This will build NDHpple as module. You can also pass this URL (http://github.com/ndavon/NDHpple) as dependency in another package but you'll still have to pass the include path as compiler flag.

USAGE

See Example/main.swift for a more detailed sample.

import NDHpple

let html = try! String(contentsOf: URL(string: url)!) 

let parser = NDHpple(HTMLData: html)
let result = parser.search(withQuery: query)

result.flatMap { $0.text }.forEach { 
        print($0)
}

Please note that some slight modifications were made that will probably break your existing implementation.

About

NDHpple is a Swift wrapper on the XMLPathQuery library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages