• Stars
    star
    600
  • Rank 74,210 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created about 13 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A light libxml wrapper for Go

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

More Repositories

1

gvm

Go Version Manager
Shell
10,035
star
2

rubex

Super Fast Regex in Go
Go
220
star
3

harlem_shaker

CSS
182
star
4

gosass

Go language wrapper for LibSass (the C/C++ implementation of Sass).
Go
73
star
5

golog

Simple logging framework for go.
Go
47
star
6

uranium

JS library for Mobile Web
JavaScript
43
star
7

go-cache

adaptive replacement cache
Go
37
star
8

tritium

Tritium is a magical document modifying language. It's JavaScript-like and simple to learn. Think XSLT without the nightmare. It was designed by Hampton Catlin (@hcatlin), and has been heavily influenced by Aaron Leung (@akhleung).
HTML
33
star
9

spracker

Go language module for generating CSS sprite sheets.
Go
19
star
10

react-storefront-boilerplate

A starter project for apps built with react-storefront
JavaScript
19
star
11

open-tritium

Open source implementation of the Tritium language.
C
18
star
12

pupstats

Pull puppet stats from syslog for use in graphite
Ruby
16
star
13

versions

Go
13
star
14

log4go

log4go extension
Go
7
star
15

css2xpath

Go
6
star
16

icu4go

go port of icu4c
HTML
6
star
17

goconv

go port of iconv
Go
6
star
18

gpkg

Go Package Manager for GVM
Go
5
star
19

fusion

Javascript bundler plugin.
Go
4
star
20

ptcp

placeholder
Go
3
star
21

craigslist

Sample project
JavaScript
2
star
22

dnsrr

Rewrite DNS for testing applications
Ruby
2
star
23

moovui

Sass UIKit for moovweb style UI elements across all of our sites
JavaScript
2
star
24

moov-pwa-boilerplate

Clone this project to start your new app based on Moov PWA.
JavaScript
1
star
25

mtv-ted

JavaScript
1
star
26

go-gb

go building tool branch (support pkg-config in cgo)
Go
1
star
27

wikipedia

Sample project - beginner example
JavaScript
1
star
28

kirkos

Go
1
star
29

mtv-reddit

JavaScript
1
star
30

xdn-templates

Templates used with create-xdn-app
TypeScript
1
star
31

xdn-examples

Example apps showing how to use various frameworks with the Moovweb XDN
Vue
1
star
32

react-storefront-express-boilerplate

Starter project for building react-storefront apps with express.
JavaScript
1
star