Support contents for defined error conditions (such as <see-other-host/>).
authorChris Jones <christian.jones@sri.com>
Sun, 25 Dec 2011 19:02:53 -0700
changeset 7 4f0f66f9a441
parent 6 8e425e340ca1
child 8 30a7752cf8f7
Support contents for defined error conditions (such as <see-other-host/>).
structs.go
structs_test.go
--- 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>`