package atomfeed import ( "errors" "fmt" "mime" ) type InlineOtherContent struct { *CommonAttributes AnyElement any `xml:"anyelement,omitempty"` Type MediaType `xml:"type,attr,omitempty"` } func newInlineOtherContent(mediaType string, content any) (*InlineOtherContent, error) { if mediaType, _, err := mime.ParseMediaType(mediaType); err != nil { return nil, fmt.Errorf("media type %v incompatible with inline other content", mediaType) } return &InlineOtherContent{Type: MediaType(mediaType), AnyElement: content}, nil } func (i *InlineOtherContent) isContent() bool { return true } func (i *InlineOtherContent) hasSRC() bool { return false } func (i *InlineOtherContent) getType() string { return string(i.Type) } func (i *InlineOtherContent) Check() error { if isCompositeMediaType(i.getType()) { return errors.New("type attribute of inline other content must not be a composite type") } return nil }