atom/xhtmlText.go

33 lines
648 B
Go
Raw Normal View History

2024-10-13 17:19:40 +02:00
package atomfeed
2024-10-15 16:02:13 +02:00
import (
"encoding/xml"
"errors"
)
type XHTMLDiv struct {
XMLName xml.Name `xml:"div"`
XMLNS string `xml:"xmlns,attr"`
Content string `xml:",innerxml"`
}
2024-10-13 17:19:40 +02:00
type XHTMLText struct {
*CommonAttributes
Type string `xml:"type,attr"` // Must be xhtml
2024-10-15 16:02:13 +02:00
XHTMLDiv XHTMLDiv
2024-10-13 17:19:40 +02:00
}
func (x *XHTMLText) IsText() bool { return true }
func (x *XHTMLText) Check() error {
if x.Type != "xhtml" {
return errors.New("type attribute of xhtml text must be xhtml")
}
2024-10-15 16:02:13 +02:00
if x.XHTMLDiv.XMLNS != "http://www.w3.org/1999/xhtml" {
return errors.New("xmlns attribute of xhtml text must be http://www.w3.org/1999/xhtml")
2024-10-13 17:19:40 +02:00
}
return nil
}