31 lines
657 B
Go
31 lines
657 B
Go
package atom
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"errors"
|
|
)
|
|
|
|
type XHTMLDiv struct {
|
|
XMLName xml.Name `xml:"div"`
|
|
XMLNS string `xml:"xmlns,attr"`
|
|
Content string `xml:",innerxml"`
|
|
}
|
|
|
|
// NewXHTMLDiv creates a new XHTMLDiv. It returns a *XHTMLDiv.
|
|
func NewXHTMLDiv(content string) *XHTMLDiv {
|
|
return &XHTMLDiv{
|
|
XMLNS: "http://www.w3.org/1999/xhtml",
|
|
Content: content,
|
|
}
|
|
}
|
|
|
|
// Check checks the XHTMLDiv for incompatibilities with RFC4287. It returns an
|
|
// error.
|
|
func (x *XHTMLDiv) Check() error {
|
|
if x.XMLNS != "http://www.w3.org/1999/xhtml" {
|
|
return errors.New("xmlns attribute of xhtml text must be http://www.w3.org/1999/xhtml")
|
|
}
|
|
|
|
return nil
|
|
}
|