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

Method HasAttr

node.go:411–419  ·  view source on GitHub ↗

HasAttr determines if an attribute exists.

(key string)

Source from the content-addressed store, hash-verified

409
410// HasAttr determines if an attribute exists.
411func (n *Node) HasAttr(key string) bool {
412 name := newXMLName(key)
413 for _, attr := range n.Attr {
414 if attr.Name == name {
415 return true
416 }
417 }
418 return false
419}
420
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.

Callers 1

AddAttrFunction · 0.80

Calls 1

newXMLNameFunction · 0.85

Tested by

no test coverage detected