sibprogrammer / xq

Command-line XML and HTML beautifier and content extractor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xquery Sets unsupported

koehn opened this issue · comments

Problem Statement

Xquery Sets are unsupported.

Steps to Reproduce

Given this input:

<bunch>
  <foo>
    <bar>abc</bar>
    <bar>def</bar>
  </foo>
  <foo>
    <bar>ghi</bar>
    <bar>jkl</bar>
  </foo>
</bunch>

This query should be valid: bunch/foo[(bar)=("abc","ghi”)]

Actual Result

panic: bunch/foo[(bar)=("abc","ghi")] has an invalid token

goroutine 18 [running]:
github.com/antchfx/xmlquery.Find(...)
        github.com/antchfx/xmlquery@v1.3.13/query.go:76
github.com/sibprogrammer/xq/internal/utils.XPathQuery({0x1031981b8?, 0x14000120000?}, {0x103198038, 0x14000120098}, {0x16d0af916, 0x1e}, 0x0)
        github.com/sibprogrammer/xq/internal/utils/utils.go:179 +0x178
github.com/sibprogrammer/xq/cmd.NewRootCmd.func1.1()
        github.com/sibprogrammer/xq/cmd/root.go:59 +0x210
created by github.com/sibprogrammer/xq/cmd.NewRootCmd.func1
        github.com/sibprogrammer/xq/cmd/root.go:55 +0x410

Expected Result

<foo>
    <bar>abc</bar>
    <bar>def</bar>
  </foo><foo>
    <bar>ghi</bar>
    <bar>jkl</bar>
  </foo>

See https://xqueryfiddle.liberty-development.net/eiZQFph