// MarshalXML handles marshalling a MessageSetList element to an XML string
324347
func (msl *MessageSetList) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
	messageSetListElement := xml.StartElement{Name: xml.Name{Local: "MSGSETLIST"}}
	if err := e.EncodeToken(messageSetListElement); err != nil {
		return err
	}
	for _, messageset := range *msl {
		if !strings.HasSuffix(messageset.Name, "V1") {
			return errors.New("Expected MessageSet.Name to end with \"V1\"")
		}
		messageSetName := strings.TrimSuffix(messageset.Name, "V1")
		messageSetElement := xml.StartElement{Name: xml.Name{Local: messageSetName}}
		if err := e.EncodeToken(messageSetElement); err != nil {
			return err
		}
		start := xml.StartElement{Name: xml.Name{Local: messageset.Name}}
		if err := e.EncodeElement(&messageset, start); err != nil {
			return err
		}
		if err := e.EncodeToken(messageSetElement.End()); err != nil {
			return err
		}
	}
	if err := e.EncodeToken(messageSetListElement.End()); err != nil {
		return err
	}
	return nil
}
1036251
func (conf *Config) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
	// Make subtype to avoid recursive UnmarshalXML().
	type config Config
	parsedConfig := config{}
	if err := d.DecodeElement(&parsedConfig, &start); err != nil {
		return err
	}

	// Empty queue list means user wants to delete the notification configuration.
	if len(parsedConfig.QueueList) > 0 {
		for i, q1 := range parsedConfig.QueueList[:len(parsedConfig.QueueList)-1] {
			for _, q2 := range parsedConfig.QueueList[i+1:] {
				if reflect.DeepEqual(q1, q2) {
					return &ErrDuplicateQueueConfiguration{q1}
				}
			}
		}
	}

	if len(parsedConfig.LambdaList) > 0 || len(parsedConfig.TopicList) > 0 {
		return &ErrUnsupportedConfiguration{}
	}

	*conf = Config(parsedConfig)

	return nil
}
1046037
func (m EntityDescriptor) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
	type Alias EntityDescriptor
	aux := &struct {
		ValidUntil    RelaxedTime `xml:"validUntil,attr,omitempty"`
		CacheDuration Duration    `xml:"cacheDuration,attr,omitempty"`
		*Alias
	}{
		ValidUntil:    RelaxedTime(m.ValidUntil),
		CacheDuration: Duration(m.CacheDuration),
		Alias:         (*Alias)(&m),
	}
	return e.Encode(aux)
}
1010
func (b Uint64) MarshalText() ([]byte, error) {
	buf := make([]byte, 2, 10)
	copy(buf, `0x`)
	buf = strconv.AppendUint(buf, uint64(b), 16)
	return buf, nil
}
161082
func UnmarshalXML(v interface{}, d *xml.Decoder, wrapper string) error {
	n, err := XMLToStruct(d, nil)
	if err != nil {
		return err
	}
	if n.Children != nil {
		for _, root := range n.Children {
			for _, c := range root {
				if wrappedChild, ok := c.Children[wrapper]; ok {
					c = wrappedChild[0] // pull out wrapped element
				}

				err = parse(reflect.ValueOf(v), c, "")
				if err != nil {
					if err == io.EOF {
						return nil
					}
					return err
				}
			}
		}
		return nil
	}
	return nil
}
635153
func (v MessageHeaders) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonCce3d1beEncodeGithubComMailgunMailgunGoEvents1(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
222734
func (m RawMessage) MarshalJSON() ([]byte, error) {
	if m == nil {
		return []byte("null"), nil
	}
	return m, nil
}
162778
func (s *SubjectConfirmationData) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
	type Alias SubjectConfirmationData
	aux := &struct {
		NotOnOrAfter RelaxedTime `xml:",attr"`
		*Alias
	}{
		NotOnOrAfter: RelaxedTime(s.NotOnOrAfter),
		Alias:        (*Alias)(s),
	}
	return e.EncodeElement(aux, start)
}
427778
func (e *ExchangeMessage) WriteXML(v interface{}) error {
	x, errXML := xml.Marshal(v)
	if errXML != nil {
		return errXML
	}
	e.body = x
	return nil
}
481273
func (ce *CoordinatesElement) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
	if err := e.EncodeToken(coordinatesStartElement); err != nil {
		return err
	}
	for i, c := range ce.coordinates {
		s := ""
		if i != 0 {
			s = " "
		}
		s += strconv.FormatFloat(c.Lon, 'f', -1, 64) + "," + strconv.FormatFloat(c.Lat, 'f', -1, 64)
		if c.Alt != 0 {
			s += "," + strconv.FormatFloat(c.Alt, 'f', -1, 64)
		}
		if err := e.EncodeToken(xml.CharData([]byte(s))); err != nil {
			return err
		}
	}
	return e.EncodeToken(coordinatesEndElement)
}
1360677
func MarshalJSON(x interface{}) ([]byte, error) {
	m, err := marshalMap(x)
	if err != nil {
		return nil, err
	}
	return json.Marshal(m)
}
1327617
func (r *AuthnRequest) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
	type Alias AuthnRequest
	aux := &struct {
		IssueInstant RelaxedTime `xml:",attr"`
		*Alias
	}{
		IssueInstant: RelaxedTime(r.IssueInstant),
		Alias:        (*Alias)(r),
	}
	return e.Encode(aux)
}
1295825
func (o *OOList) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
	ooListElement := xml.StartElement{Name: xml.Name{Local: "INVOOLIST"}}
	if err := e.EncodeToken(ooListElement); err != nil {
		return err
	}
	for _, openorder := range *o {
		start := xml.StartElement{Name: xml.Name{Local: openorder.OrderType()}}
		switch oo := openorder.(type) {
		case OOBuyDebt:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		case OOBuyMF:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		case OOBuyOpt:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		case OOBuyOther:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		case OOBuyStock:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		case OOSellDebt:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		case OOSellMF:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		case OOSellOpt:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		case OOSellOther:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		case OOSellStock:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		case OOSwitchMF:
			if err := e.EncodeElement(&oo, start); err != nil {
				return err
			}
		default:
			return errors.New("Invalid OOLIST child type: " + oo.OrderType())
		}
	}
	if err := e.EncodeToken(ooListElement.End()); err != nil {
		return err
	}
	return nil
}
1093980
func (sj *SerializerJSON) Marshal(message proto.Message) ([]byte, error) {
	if message == nil {
		return []byte("null"), nil
	}
	var buf bytes.Buffer
	if err := DefaultMarshaler.Marshal(&buf, message); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
1131649
func (r *SecurityList) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
	secListElement := xml.StartElement{Name: xml.Name{Local: "SECLIST"}}
	if err := e.EncodeToken(secListElement); err != nil {
		return err
	}
	for _, s := range r.Securities {
		start := xml.StartElement{Name: xml.Name{Local: s.SecurityType()}}
		switch sec := s.(type) {
		case DebtInfo:
			if err := e.EncodeElement(&sec, start); err != nil {
				return err
			}
		case MFInfo:
			if err := e.EncodeElement(&sec, start); err != nil {
				return err
			}
		case OptInfo:
			if err := e.EncodeElement(&sec, start); err != nil {
				return err
			}
		case OtherInfo:
			if err := e.EncodeElement(&sec, start); err != nil {
				return err
			}
		case StockInfo:
			if err := e.EncodeElement(&sec, start); err != nil {
				return err
			}
		default:
			return errors.New("Invalid SECLIST child type: " + sec.SecurityType())
		}
	}
	if err := e.EncodeToken(secListElement.End()); err != nil {
		return err
	}
	return nil
}
863008
func (arn ARN) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
	return e.EncodeElement(arn.String(), start)
}
773960
func (name *Name) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
	var s string
	if err := d.DecodeElement(&s, &start); err != nil {
		return err
	}

	eventName, err := ParseName(s)
	if err != nil {
		return err
	}

	*name = eventName
	return nil
}