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

Method Select

query.go:301–330  ·  view source on GitHub ↗
(t iterator)

Source from the content-addressed store, hash-verified

299}
300
301func (c *childQuery) Select(t iterator) NodeNavigator {
302 for {
303 if c.iterator == nil {
304 c.posit = 0
305 node := c.Input.Select(t)
306 if node == nil {
307 return nil
308 }
309 node = node.Copy()
310 first := true
311 c.iterator = func() NodeNavigator {
312 for {
313 if (first && !node.MoveToChild()) || (!first && !node.MoveToNext()) {
314 return nil
315 }
316 first = false
317 if c.Predicate(node) {
318 return node
319 }
320 }
321 }
322 }
323
324 if node := c.iterator(); node != nil {
325 c.posit++
326 return node
327 }
328 c.iterator = nil
329 }
330}
331
332func (c *childQuery) Evaluate(t iterator) interface{} {
333 c.Input.Evaluate(t)

Callers

nothing calls this directly

Calls 4

SelectMethod · 0.65
CopyMethod · 0.65
MoveToChildMethod · 0.65
MoveToNextMethod · 0.65

Tested by

no test coverage detected