Fixed a needless conversion to byte and string.
Added comment to show the purpose. Added testcase.
This commit is contained in:
parent
17e1b69620
commit
305e0dc0da
2 changed files with 46 additions and 2 deletions
4
node.go
4
node.go
|
@ -66,9 +66,11 @@ func (this *Node) GetValue() string {
|
|||
return res
|
||||
}
|
||||
|
||||
// SetValue sets the value of the node to the given parameter.
|
||||
// It deletes all children of the node so the old data does not get back at node.GetValue
|
||||
func (this *Node) SetValue(val string) {
|
||||
t := NewNode(NT_TEXT)
|
||||
t.Value = string([]byte(val))
|
||||
t.Value = val
|
||||
t.Parent = this
|
||||
this.Children = []*Node{t} // brutally replace all other children
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue