MCPcopy Create free account
hub / github.com/antchfx/xpath / Select

Method Select

query.go:808–830  ·  view source on GitHub ↗
(t iterator)

Source from the content-addressed store, hash-verified

806}
807
808func (f *filterQuery) Select(t iterator) NodeNavigator {
809 if f.positmap == nil {
810 f.positmap = make(map[int]int)
811 }
812 for {
813
814 node := f.Input.Select(t)
815 if node == nil {
816 return nil
817 }
818 node = node.Copy()
819
820 t.Current().MoveTo(node)
821 if f.do(t) {
822 // fix https://github.com/antchfx/htmlquery/issues/26
823 // Calculate and keep the each of matching node's position in the same depth.
824 level := getNodeDepth(f.Input)
825 f.positmap[level]++
826 f.posit = f.positmap[level]
827 return node
828 }
829 }
830}
831
832func (f *filterQuery) Evaluate(t iterator) interface{} {
833 f.Input.Evaluate(t)

Callers

nothing calls this directly

Calls 6

doMethod · 0.95
getNodeDepthFunction · 0.85
SelectMethod · 0.65
CopyMethod · 0.65
MoveToMethod · 0.65
CurrentMethod · 0.65

Tested by

no test coverage detected