A Microdata parser in Go
Go to file
Ian Davis ffada1099e Mad Microdata and Item fields public 2012-06-10 18:57:35 +01:00
README.md Mad Microdata and Item fields public 2012-06-10 18:57:35 +01:00
microdata.go Mad Microdata and Item fields public 2012-06-10 18:57:35 +01:00
microdata_test.go Mad Microdata and Item fields public 2012-06-10 18:57:35 +01:00

README.md

microdata - a microdata parser in Go

INSTALLATION

Simply run

go get github.com/iand/microdata

Documentation is at http://go.pkgdoc.org/github.com/iand/microdata

USAGE

Example of parsing a string containing HTML:

include (
	"net/url"
	"strings"
)
html = `<div itemscope>
 <p>My name is <span itemprop="name">Elizabeth</span>.</p>
</div>`

baseUrl, _ := url.Parse("http://example.com/")
p := NewParser(strings.NewReader(html), baseUrl)

data, err := p.Parse()
if err != nil {
	t.Errorf("Expected no error but got %d", err)
}

println("Name: ", data.items[0].properties["name"][0]