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

Method Select

query.go:368–397  ·  view source on GitHub ↗
(t iterator)

Source from the content-addressed store, hash-verified

366}
367
368func (c *cachedChildQuery) Select(t iterator) NodeNavigator {
369 for {
370 if c.iterator == nil {
371 c.posit = 0
372 node := c.Input.Select(t)
373 if node == nil {
374 return nil
375 }
376 node = node.Copy()
377 first := true
378 c.iterator = func() NodeNavigator {
379 for {
380 if (first && !node.MoveToChild()) || (!first && !node.MoveToNext()) {
381 return nil
382 }
383 first = false
384 if c.Predicate(node) {
385 return node
386 }
387 }
388 }
389 }
390
391 if node := c.iterator(); node != nil {
392 c.posit++
393 return node
394 }
395 c.iterator = nil
396 }
397}
398
399func (c *cachedChildQuery) Evaluate(t iterator) interface{} {
400 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