~samwhited/xmpp

0ff76eeb3b948479353ddc6def3cf3771f170299 — Sam Whited 4 years ago 7e0762c
internal: add an XML helper for getting attributes
1 files changed, 18 insertions(+), 0 deletions(-)

A internal/xmlutil.go
A internal/xmlutil.go => internal/xmlutil.go +18 -0
@@ 0,0 1,18 @@
// Copyright 2017 Sam Whited.
// Use of this source code is governed by the BSD 2-clause license that can be
// found in the LICENSE file.

package internal

import (
	"encoding/xml"
)

func GetAttr(attr []xml.Attr, local string) string {
	for _, a := range attr {
		if a.Name.Local == local {
			return a.Value
		}
	}
	return ""
}