Content can also be empty

This commit is contained in:
2024-10-17 18:40:52 +02:00
parent 5a82f1799f
commit e73b78ef30
2 changed files with 8 additions and 4 deletions

View File

@@ -16,8 +16,10 @@ type Category struct {
// NewCategory creates a new Category. It returns a *Category and an error.
func NewCategory(term, content string) (*Category, error) {
if !isValidXML(content) {
return nil, fmt.Errorf("%v not valid XML", content)
if content != "" {
if !isValidXML(content) {
return nil, fmt.Errorf("%v not valid XML", content)
}
}
return &Category{Term: term, Content: content}, nil