Support contents for defined error conditions (such as <see-other-host/>).
--- a/structs.go Sun Dec 25 18:46:13 2011 -0700
+++ b/structs.go Sun Dec 25 19:02:53 2011 -0700
@@ -57,6 +57,7 @@
type definedCondition struct {
// Must always be in namespace nsStreams
XMLName xml.Name
+ Chardata string `xml:"chardata"`
}
type errText struct {
--- a/structs_test.go Sun Dec 25 18:46:13 2011 -0700
+++ b/structs_test.go Sun Dec 25 19:02:53 2011 -0700
@@ -69,13 +69,13 @@
func TestStreamErrorMarshal(t *testing.T) {
name := xml.Name{Space: nsStreams, Local: "ack"}
- e := &StreamError{Any: definedCondition{name}}
+ e := &StreamError{Any: definedCondition{XMLName: name}}
exp := `<stream:error><ack xmlns="` + nsStreams +
`"></ack></stream:error>`;
assertMarshal(t, exp, e)
txt := errText{Lang: "pt", Text: "things happen"}
- e = &StreamError{Any: definedCondition{name}, Text: &txt}
+ e = &StreamError{Any: definedCondition{XMLName: name}, Text: &txt}
exp = `<stream:error><ack xmlns="` + nsStreams +
`"></ack><text xmlns="` + nsStreams +
`" xml:lang="pt">things happen</text></stream:error>`