diff --git a/entry.go b/entry.go index de6ec22..414f894 100644 --- a/entry.go +++ b/entry.go @@ -43,6 +43,16 @@ func (e *Entry) checkAuthors() error { return nil } +func alternateRelExists(l []*Link) bool { + for _, link := range l { + if link.Rel == "alternate" { + return true + } + } + + return false +} + func (e *Entry) AddExtension(name string, value any) { e.Extensions = append(e.Extensions, &ExtensionElement{XMLName: xml.Name{Local: name}, Value: value}) } @@ -72,6 +82,10 @@ func (e *Entry) Check() error { if err := (*e.Content).Check(); err != nil { return fmt.Errorf("content element of entry %v: %v", e.ID.URI, err) } + } else { + if !alternateRelExists(e.Links) { + return errors.New("no content element of entry %v and no link element with rel \"alternate\"") + } } if e.Contributors != nil {