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

Method Value

xpath_test.go:441–462  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

439}
440
441func (n *TNodeNavigator) Value() string {
442 switch n.curr.Type {
443 case CommentNode:
444 return n.curr.Data
445 case ElementNode:
446 if n.attr != -1 {
447 return n.curr.Attr[n.attr].Value
448 }
449 var buf bytes.Buffer
450 node := n.curr.FirstChild
451 for node != nil {
452 if node.Type == TextNode {
453 buf.WriteString(strings.TrimSpace(node.Data))
454 }
455 node = node.NextSibling
456 }
457 return buf.String()
458 case TextNode:
459 return n.curr.Data
460 }
461 return ""
462}
463
464func (n *TNodeNavigator) Copy() NodeNavigator {
465 n2 := *n

Callers 1

StringMethod · 0.95

Calls 2

WriteStringMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected