Skip to content

Commit bc870b7

Browse files
committed
Updated the README.md
1 parent 62755a7 commit bc870b7

File tree

3 files changed

+18
-32
lines changed

3 files changed

+18
-32
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"gohtml",
99
"Kottue",
1010
"linkedliststack",
11+
"println",
1112
"yosssi"
1213
]
1314
}

FUTURE-CHANGELOG.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
## v0.0.3
2-
- Write test for (closest, QuerySelector, QuerySelectorAll)
3-
- Serializer bug fix
4-
5-
## TODO
6-
* Update the the readme example and change the CHANGELOG
71

README.md

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,27 @@ import (
2626
- Querying
2727

2828
## Example
29+
2930
Heres an example of fetching a website and parsing and then using querying methods.
31+
3032
```go
31-
res, err := http.Get("https://www.metalsucks.net/")
32-
if err != nil {
33-
t.Fatal(err)
34-
}
35-
defer res.Body.Close()
36-
37-
//Parses the given html reader and then returns the root node and an error.
38-
node, err := GoHtml.Decode(res.Body)
39-
if err != nil {
40-
t.Fatal(err)
41-
}
42-
43-
nodeList := node.GetElementsByClassName("post-title")
44-
iter := nodeList.IterNodeList()
45-
for node := range iter{
46-
print(node.GetInnerText())
47-
}
33+
res, err := http.Get("https://www.metalsucks.net/")
34+
if err != nil {
35+
t.Fatal(err)
36+
}
37+
defer res.Body.Close()
38+
39+
node, err := GoHtml.Decode(res.Body)
40+
if err != nil {
41+
t.Fatal(err)
42+
}
43+
44+
nodeList := node.QuerySelectorAll(".left-content article .post-title")
45+
for node := range nodeList.IterNodeList(){
46+
println(node.GetInnerText())
47+
}
4848
```
4949

50-
## Changelog
51-
52-
Changes, bug fixes and new features in this version.
53-
- add: Closest
54-
- add: QuerySearch
55-
- add: QuerySelector
56-
- add: QuerySelectorAll
57-
- renamed: Tokenizer CurrentNode method to GetCurrentNode.
58-
5950
## Documentation
6051

6152
Fully fledged [documentation](https://pkg.go.dev/github.com/udan-jayanith/GoHTML) is available at [go.pkg](https://pkg.go.dev/)

0 commit comments

Comments
 (0)