github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/html/xpath_selector.go (about) 1 package html 2 3 import ( 4 "context" 5 6 "github.com/MontFerret/ferret/pkg/drivers" 7 8 "github.com/MontFerret/ferret/pkg/runtime/core" 9 "github.com/MontFerret/ferret/pkg/runtime/values" 10 ) 11 12 // X returns QuerySelector of XPath kind. 13 // @param {String} expression - XPath expression. 14 // @return {Any} - Returns QuerySelector of XPath kind. 15 func XPathSelector(_ context.Context, args ...core.Value) (core.Value, error) { 16 if err := core.ValidateArgs(args, 1, 1); err != nil { 17 return values.None, err 18 } 19 20 return drivers.NewXPathSelector(values.ToString(args[0])), nil 21 }