atom/xhtmlText.go

30 lines
647 B
Go

package atom
import (
"errors"
"fmt"
)
type XHTMLText struct {
*CommonAttributes
Type string `xml:"type,attr"` // Must be xhtml
XHTMLDiv XHTMLDiv
}
// isText checks whether the XHTMLText is a Text. It returns a bool.
func (x *XHTMLText) isText() bool { return true }
// Check checks the XHTMLText for incompatibilities with RFC4287. It returns an
// error.
func (x *XHTMLText) Check() error {
if x.Type != "xhtml" {
return errors.New("type attribute of xhtml text must be xhtml")
}
if err := x.XHTMLDiv.Check(); err != nil {
return fmt.Errorf("xhtml div element %v of xhtml text %v: %v", x.XHTMLDiv, x, err)
}
return nil
}