gokogiri

A light libxml wrapper for Go

  • Owner: moovweb/gokogiri
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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

Installation

# Linux
sudo apt-get install libxml2-dev
# Mac
brew install libxml2

go get github.com/moovweb/gokogiri

Running tests

go test github.com/moovweb/gokogiri/...

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()
}

Main metrics

Overview
Name With Ownermoovweb/gokogiri
Primary LanguageGo
Program languageGo (Language Count: 3)
Platform
License:MIT License
所有者活动
Created At2011-07-14 11:10:24
Pushed At2023-05-27 07:23:05
Last Commit At2018-07-13 12:54:10
Release Count2124
Last Release Name5.999.253 (Posted on )
First Release NameR_2 (Posted on 2011-11-15 18:26:48)
用户参与
Stargazers Count605
Watchers Count54
Fork Count95
Commits Count627
Has Issues Enabled
Issues Count58
Issue Open Count19
Pull Requests Count30
Pull Requests Open Count2
Pull Requests Close Count16
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private