1 Commits

Author SHA1 Message Date
3c312aa3ed Allow entries to be published without any outer feed 2024-10-18 05:00:24 +02:00

View File

@@ -249,3 +249,13 @@ func (e *Entry) Check() error {
return nil
}
// ToXML converts the Feed to XML. It returns a string and an error.
func (e *Entry) ToXML(encoding string) (string, error) {
xml, err := xml.MarshalIndent(e, "", " ")
if err != nil {
return "", fmt.Errorf("error xml encoding entry: %v", err)
}
return fmt.Sprintln(`<?xml version="1.0" encoding="`+encoding+`"?>`) + string(xml), nil
}