SetAttr allows an attribute value with the specified name to be changed. If the attribute did not previously exist, it will be created.
(key, value string)
| 421 | // SetAttr allows an attribute value with the specified name to be changed. |
| 422 | // If the attribute did not previously exist, it will be created. |
| 423 | func (n *Node) SetAttr(key, value string) bool { |
| 424 | name := newXMLName(key) |
| 425 | for i, attr := range n.Attr { |
| 426 | if attr.Name == name { |
| 427 | n.Attr[i].Value = value |
| 428 | return true |
| 429 | } |
| 430 | } |
| 431 | return AddAttr(n, key, value) |
| 432 | } |
| 433 | |
| 434 | // RemoveAttr removes the attribute with the specified name. |
| 435 | func (n *Node) RemoveAttr(key string) bool { |