File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# GoHTML
2+
23A powerful and comprehensive HTML parser and DOM manipulation library for Go, bringing JavaScript-like DOM operations to the Go ecosystem.
34
45## Installation
5- Run the following command in project directory in order to install.
6+
7+ Run the following command in project directory in order to install.
8+
69``` bash
710go get github.com/udan-jayanith/GoHTML
811```
912
1013Then GoHTML can import like this.
14+
1115``` go
1216import (
1317 GoHtml " github.com/udan-jayanith/GoHTML"
1418)
1519```
1620
1721## Features
18- * Parsing
19- * Serialization
20- * Node tree traversing
21- * Querying
22+
23+ - Parsing
24+ - Serialization
25+ - Node tree traversing
26+ - Querying
27+
28+ ## Example
29+ Heres an example of fetching a website and parsing and then using querying methods.
30+ ``` go
31+ res , err := http.Get (" https://www.metalsucks.net/" )
32+ if err != nil {
33+ t.Fatal (err)
34+ }
35+
36+ // Parses the given html reader and then returns the root node and an error.
37+ node , err := GoHtml .Decode (res.Body )
38+ if err != nil {
39+ t.Fatal (err)
40+ }
41+
42+ nodeList := node.GetElementsByClassName (" post-title" )
43+ iter := nodeList.IterNodeList ()
44+ for node := range iter{
45+ print (node.GetInnerText ())
46+ }
47+ ```
2248
2349## Changelog
50+
2451Changes, bug fixes and new features in this version.
52+
2553- add: NodeList
2654- add: Querying helper functions
2755- add: ClassList
2856- bug fix: Empty attribute value parsing bug fixed
2957- changed: Renamed GetTraverser to NewTraverser
3058
3159## Documentation
60+
3261Fully fledged [ documentation] ( https://pkg.go.dev/github.com/udan-jayanith/GoHTML ) is available at [ go.pkg] ( https://pkg.go.dev/ )
3362
3463## Contributions
64+
3565Contributions are welcome and pull requests and issues will be viewed by an official.
You can’t perform that action at this time.
0 commit comments