Return the index of the added element

This commit is contained in:
2024-10-20 12:57:24 +02:00
parent 764b143ff8
commit 8ce7d54d00
7 changed files with 65 additions and 59 deletions

View File

@@ -17,9 +17,9 @@ func newCommonAttributes() *CommonAttributes {
return new(CommonAttributes)
}
// AddAttribute adds the attribute to the CommonAttributes.
func (c *CommonAttributes) AddAttribute(name, value string) {
addToSlice(&c.UndefinedAttributes, &xml.Attr{Name: xml.Name{Local: name}, Value: value})
// AddAttribute adds the attribute to the CommonAttributes. It returns an int.
func (c *CommonAttributes) AddAttribute(name, value string) int {
return addToSlice(&c.UndefinedAttributes, &xml.Attr{Name: xml.Name{Local: name}, Value: value})
}
// DeleteAttribute deletes the attribute at index from the CommonAttributes. It