()
| 439 | } |
| 440 | |
| 441 | func (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 | |
| 464 | func (n *TNodeNavigator) Copy() NodeNavigator { |
| 465 | n2 := *n |
no test coverage detected