Minor fixups to make this come closer to working. It doesn't actually
work, though, because the nesting in XML is backwards from how it is
in Go. <iq><query/></iq> vs. RosterIq { Iq }
--- a/roster.go Fri Dec 30 21:49:00 2011 -0700
+++ b/roster.go Sat Dec 31 10:11:01 2011 -0700
@@ -36,6 +36,10 @@
Group []string
}
+func (riq *RosterIq) MarshalXML() ([]byte, os.Error) {
+ return marshalXML(riq)
+}
+
func (riq *RosterIq) InnerMarshal(w io.Writer) os.Error {
return xml.Marshal(w, riq.Query)
}
--- a/stream.go Fri Dec 30 21:49:00 2011 -0700
+++ b/stream.go Sat Dec 31 10:11:01 2011 -0700
@@ -158,7 +158,7 @@
obj = con(&name)
xmlStr, _ := marshalXML(st)
r := bytes.NewBuffer(xmlStr)
- err = xml.Unmarshal(r, &obj)
+ err = xml.Unmarshal(r, obj)
if err != nil {
log.Printf("ext unmarshal: %v",
err)
--- a/structs.go Fri Dec 30 21:49:00 2011 -0700
+++ b/structs.go Sat Dec 31 10:11:01 2011 -0700
@@ -99,6 +99,7 @@
}
type ExtendedStanza interface {
+ Stanza
InnerMarshal(io.Writer) os.Error
}