func (l *Ltxref) MarshalXML(e *xml.Encoder, start xml.StartElement) error { eltname := xml.Name{Local: "ltxref", Space: "urn:speedata.de:2015:latexref"} startelt := xml.StartElement{Name: eltname} startelt.Attr = append(startelt.Attr, xml.Attr{Name: xml.Name{Local: "version"}, Value: l.Version}) e.Indent("", " ") err := e.EncodeToken(startelt) if err != nil { return err } err = e.Encode(l.Commands) if err != nil { return err } err = e.Encode(l.Environments) if err != nil { return err } err = e.Encode(l.DocumentClasses) if err != nil { return err } err = e.Encode(l.Packages) if err != nil { return err } err = e.EncodeToken(xml.EndElement{Name: eltname}) if err != nil { return err } if false { return errors.New("dummy error") } return nil }