structs.go
changeset 31 1dc47df5c99f
parent 28 78961db80bae
child 32 4e68d8f89dc3
equal deleted inserted replaced
30:a77fc342e013 31:1dc47df5c99f
    38 }
    38 }
    39 var _ xml.Marshaler = &stream{}
    39 var _ xml.Marshaler = &stream{}
    40 var _ fmt.Stringer = &stream{}
    40 var _ fmt.Stringer = &stream{}
    41 
    41 
    42 // <stream:error>
    42 // <stream:error>
    43 // BUG(cjyar) Can this be consolidated with Error? Hide it if not.
    43 type streamError struct {
    44 type StreamError struct {
       
    45 	Any Generic
    44 	Any Generic
    46 	Text *errText
    45 	Text *errText
    47 }
    46 }
    48 var _ xml.Marshaler = &StreamError{}
    47 var _ xml.Marshaler = &streamError{}
    49 
    48 
    50 type errText struct {
    49 type errText struct {
    51 	Lang string `xml:"attr"`
    50 	Lang string `xml:"attr"`
    52 	Text string `xml:"chardata"`
    51 	Text string `xml:"chardata"`
    53 }
    52 }
   220 		}
   219 		}
   221 	}
   220 	}
   222 	return s, nil
   221 	return s, nil
   223 }
   222 }
   224 
   223 
   225 func (s *StreamError) MarshalXML() ([]byte, os.Error) {
   224 func (s *streamError) MarshalXML() ([]byte, os.Error) {
   226 	buf := bytes.NewBuffer(nil)
   225 	buf := bytes.NewBuffer(nil)
   227 	buf.WriteString("<stream:error>")
   226 	buf.WriteString("<stream:error>")
   228 	xml.Marshal(buf, s.Any)
   227 	xml.Marshal(buf, s.Any)
   229 	if s.Text != nil {
   228 	if s.Text != nil {
   230 		xml.Marshal(buf, s.Text)
   229 		xml.Marshal(buf, s.Text)