diff --git a/xmpp.go b/xmpp.go
index 8876483..669b45b 100644
--- a/xmpp.go
+++ b/xmpp.go
@@ -1009,6 +1009,7 @@ func (m *clientMessage) OtherStrings() []string {
type XMLElement struct {
XMLName xml.Name
+ Attr []xml.Attr `xml:",any,attr"` // Save the attributes of the xml element
InnerXML string `xml:",innerxml"`
}
diff --git a/xmpp_test.go b/xmpp_test.go
index 2966d98..ca7ec09 100644
--- a/xmpp_test.go
+++ b/xmpp_test.go
@@ -87,10 +87,12 @@ func TestStanzaError(t *testing.T) {
OtherElem: []XMLElement{
XMLElement{
XMLName: xml.Name{Space: "google:mobile:data", Local: "gcm"},
+ Attr: []xml.Attr{xml.Attr{Name:xml.Name{Space:"", Local:"xmlns"}, Value:"google:mobile:data"}},
InnerXML: "\n\t\t{\"random\": \"<text>\"}\n\t",
},
XMLElement{
XMLName: xml.Name{Space: "jabber:client", Local: "error"},
+ Attr: []xml.Attr{xml.Attr{Name:xml.Name{Space:"", Local:"code"}, Value:"400"},xml.Attr{Name:xml.Name{Space:"", Local:"type"}, Value:"modify"}},
InnerXML: `