Skip to content

Instantly share code, notes, and snippets.

@kyleconroy
Created May 29, 2014 06:31
Show Gist options
  • Save kyleconroy/ac8c34cb72fe2624dcc4 to your computer and use it in GitHub Desktop.
Save kyleconroy/ac8c34cb72fe2624dcc4 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"github.com/kyleconroy/soup"
)
func main() {
doc := soup.NewSoup(reader)
// Find a list of elements
divs := soup.FindAll("div")
// Find the first elelemnt
div := doc.Find("div.hello")
// Get an attribute
div.Attr("foo")
// Flatten the node into a string representation
div.String()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment