Allow entries to be published without any outer feed
This commit is contained in:
parent
9445a7c4cd
commit
3c312aa3ed
10
entry.go
10
entry.go
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user