A light libxml wrapper for Go
Go C
Latest commit eafc181 Jan 20, 2015 Aaron Leung tweaks
Permalink
Failed to load latest commit information.
css making master branch go-getable Oct 24, 2013
help removing unnecessary make files Oct 25, 2013
html removing unnecessary make files Oct 25, 2013
mem removing unnecessary make files Oct 25, 2013
util removing unnecessary make files Oct 25, 2013
xml
xpath Redefine nodeset to be more useful Nov 3, 2013
.gitignore Issue 55 changes to make xml package work on OS X 10.9 Jan 23, 2014
AUTHOR new implementation Feb 27, 2012
LICENSE add a license Aug 20, 2012
Readme.md tweaks Jan 20, 2015
VERSION new implementation Feb 27, 2012
gokogiri.go Documentation strings for the gokogiri module and the AttributeNode. Dec 18, 2013
gokogiri_test.go making master branch go-getable Oct 24, 2013

Readme.md

Gokogiri

LibXML bindings for the Go programming language.

By Zhigang Chen and Hampton Catlin

This is a major rewrite from v0 in the following places:

  • Separation of XML and HTML
  • Put more burden of memory allocation/deallocation on Go
  • Fragment parsing -- no more deep-copy
  • Serialization
  • Some API adjustment

To install:

  • sudo apt-get install libxml2-dev
  • go get github.com/moovweb/gokogiri

To run test:

  • go test github.com/moovweb/gokogiri/html
  • go test github.com/moovweb/gokogiri/xml

Basic example:

package main

import (
  "net/http"
  "io/ioutil"
  "github.com/moovweb/gokogiri"
)

func main() {
  // fetch and read a web page
  resp, _ := http.Get("http://www.google.com")
  page, _ := ioutil.ReadAll(resp.Body)

  // parse the web page
  doc, _ := gokogiri.ParseHtml(page)

  // perform operations on the parsed page -- consult the tests for examples

  // important -- don't forget to free the resources when you're done!
  doc.Free()
}