MCPcopy Create free account
hub / github.com/antchfx/xmlquery / RemoveAttr

Method RemoveAttr

node.go:435–444  ·  view source on GitHub ↗

RemoveAttr removes the attribute with the specified name.

(key string)

Source from the content-addressed store, hash-verified

433
434// RemoveAttr removes the attribute with the specified name.
435func (n *Node) RemoveAttr(key string) bool {
436 name := newXMLName(key)
437 for i, attr := range n.Attr {
438 if attr.Name == name {
439 n.Attr = append(n.Attr[:i], n.Attr[i+1:]...)
440 return true
441 }
442 }
443 return false
444}
445
446// AddChild adds a new node 'n' to a node 'parent' as its last child.
447func AddChild(parent, n *Node) {

Callers 1

TestRemoveAttrFunction · 0.80

Calls 1

newXMLNameFunction · 0.85

Tested by 1

TestRemoveAttrFunction · 0.64