More XML attribute fixes. go.weekly.2012-01-15
authorChris Jones <chris@cjones.org>
Thu, 24 May 2012 23:27:31 -0600
branchgo.weekly.2012-01-15
changeset 94 0ef947611eec
parent 93 fbd51fa6b7ea
child 95 6eac4867d095
child 96 45b5ad8e5d78
More XML attribute fixes.
structs.go
--- a/structs.go	Sun Apr 15 11:20:55 2012 -0600
+++ b/structs.go	Thu May 24 23:27:31 2012 -0600
@@ -31,18 +31,19 @@
 
 // XMPP's <stream:stream> XML element
 type stream struct {
-	XMLName xml.Name `xml:"stream stream"`
-	To      string `xml:"to,attr"`
-	From    string `xml:"from,attr"`
-	Id      string `xml:"id,attr"`
-	Lang    string `xml:"lang,attr"`
-	Version string `xml:"version,attr"`
+	XMLName xml.Name `xml:"stream http://etherx.jabber.org/streams"`
+	To      string `xml:"to,attr,omitempty"`
+	From    string `xml:"from,attr,omitempty"`
+	Id      string `xml:"id,attr,omitempty"`
+	Lang    string `xml:"lang,attr,omitempty"`
+	Version string `xml:"version,attr,omitempty"`
 }
 
 var _ fmt.Stringer = &stream{}
 
 // <stream:error>
 type streamError struct {
+	XMLName xml.Name `xml:"stream:error"`
 	Any  Generic  `xml:",any"`
 	Text *errText `xml:"text"`
 }