mirror of
https://github.com/FluuxIO/go-xmpp.git
synced 2024-11-21 01:52:01 -08:00
Do not repeat xmlns in attributes on parsing
This commit is contained in:
parent
dade3504f0
commit
c821267928
8
iq.go
8
iq.go
@ -166,7 +166,13 @@ type Node struct {
|
||||
}
|
||||
|
||||
func (n *Node) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
||||
n.Attrs = start.Attr
|
||||
// Assign "n.Attrs = start.Attr", without repeating xmlns in attributes
|
||||
for _, attr := range start.Attr {
|
||||
// Do not repeat xmlns
|
||||
if attr.Name.Local != "xmlns" {
|
||||
n.Attrs = append(n.Attrs, attr)
|
||||
}
|
||||
}
|
||||
type node Node
|
||||
return d.DecodeElement((*node)(n), &start)
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ func TestGenerateIq(t *testing.T) {
|
||||
},
|
||||
Nodes: []Node{
|
||||
{XMLName: xml.Name{
|
||||
Space: "http://jabber.org/protocol/disco#info",
|
||||
Local: "identity",
|
||||
},
|
||||
Attrs: []xml.Attr{
|
||||
|
Loading…
Reference in New Issue
Block a user