Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A light libxml wrapper for Go
Go C
Latest commit eafc181 Aaron Leung tweaks


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

To run test:

  • go test
  • go test

Basic example:

package main

import (

func main() {
  // fetch and read a web page
  resp, _ := http.Get("")
  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!
Something went wrong with that request. Please try again.