2024-10-16 21:28:04 +02:00
|
|
|
package atom
|
2024-10-13 17:19:40 +02:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2024-10-16 19:59:28 +02:00
|
|
|
// isText checks whether the XHTMLText is a Text. It returns a bool.
|
2024-10-16 18:31:24 +02:00
|
|
|
func (x *XHTMLText) isText() bool { return true }
|
2024-10-13 17:19:40 +02:00
|
|
|
|
2024-10-16 19:59:28 +02:00
|
|
|
// Check checks the XHTMLText for incompatibilities with RFC4287. It returns an
|
|
|
|
// error.
|
2024-10-13 17:19:40 +02:00
|
|
|
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
|
|
|
|
}
|