Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
doc: fix examples of query/iter API
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
  • Loading branch information
bzz authored and dennwc committed Nov 23, 2018
1 parent 675e9da commit 33c20cf
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,17 @@ produces
```

```go
iter, err := tools.NewIterator(res.UAST)
if err != nil {
panic(err)
}

iter := tools.NewIterator(res, tools.PreOrder)
for node := range tools.Iterate(iter) {
fmt.Println(node)
fmt.Println(node)
}

// For XPath expressions returning a boolean/numeric/string value, you must
// use the right typed Filter function:

boolres, err := FilterBool(res.UAST, "boolean(//*[@start-offset or @end-offset])")
strres, err := FilterString(res.UAST, "name(//*[1])")
numres, err := FilterNumber(res.UAST, "count(//*)")
boolres, err := tools.FilterBool(res, "boolean(//*[@start-offset or @end-offset])")
strres, err := tools.FilterString(res, "name(//*[1])")
numres, err := tools.FilterNumber(res, "count(//*)")
```

Please read the [Babelfish clients](https://doc.bblf.sh/using-babelfish/clients.html) guide section to learn more about babelfish clients and their query language.
Expand Down

0 comments on commit 33c20cf

Please sign in to comment.