package atomfeed import ( "errors" "fmt" "reflect" ) type InlineXHTMLContent struct { *CommonAttributes Type string `xml:"type,attr"` XHTMLDiv string `xml:"xhtmldiv"` } func newInlineXHTMLContent(mediaType string, content any) (*InlineXHTMLContent, error) { if mediaType != "xhtml" { return nil, fmt.Errorf("media type %v incompatible with inline xhtml content", mediaType) } if reflect.TypeOf(content).Kind() != reflect.String { return nil, fmt.Errorf("content type %T incompatible with inline xhtml content", content) } return &InlineXHTMLContent{Type: mediaType, XHTMLDiv: content.(string)}, nil } func (i *InlineXHTMLContent) isContent() bool { return true } func (i *InlineXHTMLContent) hasSRC() bool { return false } func (i *InlineXHTMLContent) getType() string { return i.Type } func (i *InlineXHTMLContent) Check() error { if i.Type != "xhtml" { return errors.New("type attribute of inline xhtml content must be xhtml") } if i.XHTMLDiv == "" { return errors.New("xhtmlDiv element of inline xhtml content empty") } return nil }