Fixed a needless conversion to byte and string.

Added comment to show the purpose.
Added testcase.
This commit is contained in:
Guido Witmond 2015-01-05 20:54:53 +01:00
parent 17e1b69620
commit 305e0dc0da
2 changed files with 46 additions and 2 deletions

View file

@ -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
}