We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
Thank you for this package.
I am trying to query a range, but the result is wrong when using and operator:
and
package main import ( "fmt" "github.com/antchfx/jsonquery" "strings" ) func main() { s := `{ "phoneNumbers": [ { "type" : "mobile", "number": "0123-4567-0001" }, { "type" : "home", "number": "0123-4567-0002" }, { "type" : "office", "number": "0123-4567-0003" }, { "type" : "fax", "number": "0123-4567-0004" } ] }` doc, err := jsonquery.Parse(strings.NewReader(s)) if err != nil { panic(err) } fmt.Println("print [2,end):") for _, n := range jsonquery.Find(doc, "phoneNumbers/*[ position()>=2 ]/number") { fmt.Println(n.InnerText()) } fmt.Println("print [2,4):") for _, n := range jsonquery.Find(doc, "phoneNumbers/*[ position()>=2 and position()<4 ]/number") { fmt.Println(n.InnerText()) } fmt.Println("print [2,4):") for _, n := range jsonquery.Find(doc, "phoneNumbers/*[ position()<4 and position()>=2 ]/number") { fmt.Println(n.InnerText()) } }
Output:
print [2,end): 0123-4567-0002 0123-4567-0003 0123-4567-0004 print [2,4): 0123-4567-0002 0123-4567-0003 0123-4567-0004 print [2,4):
Playground
It returns extra entries or nothing at all depending on how you order the operands.
Any idea?
The text was updated successfully, but these errors were encountered:
I have tested, this bug is by xpath package.
xpath
Sorry, something went wrong.
fix position(), last() repeats called in the same node. antchfx/jsonq…
9f7395f
…uery#3
b8565c1
fixed in v1.1.4.
No branches or pull requests
Hi,
Thank you for this package.
I am trying to query a range, but the result is wrong when using
and
operator:Output:
Playground
It returns extra entries or nothing at all depending on how you order the operands.
Any idea?
The text was updated successfully, but these errors were encountered: