diff --git a/inlineXHTMLContent.go b/inlineXHTMLContent.go
index 0d0b33e..41030be 100644
--- a/inlineXHTMLContent.go
+++ b/inlineXHTMLContent.go
@@ -1,6 +1,10 @@
package atomfeed
-import "errors"
+import (
+ "errors"
+ "fmt"
+ "reflect"
+)
type InlineXHTMLContent struct {
*CommonAttributes
@@ -8,6 +12,18 @@ type InlineXHTMLContent struct {
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 }