Exemple #1
0
func TestGetTokensOfType(t *testing.T) {

	actual := query.GetTokensOfType(simpleHTML, "p")

	if len(actual) != 2 {
		t.Error("Expected 2 matching tokens")
	}

}
Exemple #2
0
func main() {
	html, _ := FetchURL("http://owainlewis.com")

	tokens := query.GetTokensOfType(html, "a")

	for _, token := range tokens {
		printToken(token)
	}

	attrQuery := query.GetAttributes(html, "href", "/articles")

	for _, token := range attrQuery {
		printToken(token)
	}
}