html-query: a fluent and functional approach to querying HTML DOM

html-query is a Go package that provides a fluent and functional interface for querying HTML DOM. It is based on go.net/html. Examples A simple example (under “examples” directory) r := get(`http://blog.golang.org/index`) defer r.Close() root, err := query.Parse(r) checkError(err) root.Div(Id("content")).Children(Class("blogtitle")).For(func(item *query.Node) { href := item.Ahref().Href() date := item.Span(Class("date")).Text() tags := item.Span(Class("tags")).Text() // ...... }) Generator of html-query (under “gen” directory) A large part of html-query is automatically generated from HTML spec. The spec is in HTML format, so the generator parses it using html-query itself. ...

January 20, 2014