MCPcopy Index your code
hub / github.com/antchfx/xmlquery / InnerText

Method InnerText

node.go:141–158  ·  view source on GitHub ↗

InnerText returns the text between the start and end tags of the object.

()

Source from the content-addressed store, hash-verified

139
140// InnerText returns the text between the start and end tags of the object.
141func (n *Node) InnerText() string {
142 var output func(*strings.Builder, *Node)
143 output = func(b *strings.Builder, n *Node) {
144 switch n.Type {
145 case TextNode, CharDataNode:
146 b.WriteString(n.Data)
147 case CommentNode:
148 default:
149 for child := n.FirstChild; child != nil; child = child.NextSibling {
150 output(b, child)
151 }
152 }
153 }
154
155 var b strings.Builder
156 output(&b, n)
157 return b.String()
158}
159
160// ChildNodes returns all the child nodes of the current node,
161// including text, comments, and char data.

Callers 8

SelectAttrMethod · 0.95
TestNamespaceURLFunction · 0.80
TestParseFunction · 0.80
TestCharDataFunction · 0.80
ValueMethod · 0.80
ExampleFunction · 0.80
TestQueryWithPrefixFunction · 0.80

Calls 1

StringMethod · 0.80

Tested by 6

TestNamespaceURLFunction · 0.64
TestParseFunction · 0.64
TestCharDataFunction · 0.64
ExampleFunction · 0.64
TestQueryWithPrefixFunction · 0.64