49 lines
1.3 KiB
Go
49 lines
1.3 KiB
Go
package atom
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"fmt"
|
|
)
|
|
|
|
type InlineXHTMLContent struct {
|
|
XMLName xml.Name `xml:"content"`
|
|
*CommonAttributes
|
|
XHTMLDiv *XHTMLDiv
|
|
Type string `xml:"type,attr"`
|
|
}
|
|
|
|
// newInlineXHTMLContent creates a new InlineXHTMLContent. It returns a
|
|
// *InlineXHTMLContent.
|
|
func newInlineXHTMLContent(mediaType string, div *XHTMLDiv) *InlineXHTMLContent {
|
|
return &InlineXHTMLContent{
|
|
CommonAttributes: newCommonAttributes(),
|
|
Type: mediaType,
|
|
XHTMLDiv: div,
|
|
}
|
|
}
|
|
|
|
// isContent checks whether the InlineXHTMLContent is a Content. It returns a
|
|
// bool.
|
|
func (i *InlineXHTMLContent) isContent() bool { return true }
|
|
|
|
// hasSRC checks whether the InlineXHTMLContent has a SRC attribute. It returns
|
|
// a bool.
|
|
func (i *InlineXHTMLContent) hasSRC() bool { return false }
|
|
|
|
// getType returns the Type of the InlineXHTMLContent as a string.
|
|
func (i *InlineXHTMLContent) getType() string { return i.Type }
|
|
|
|
// Check checks the InlineXHTMLContent for incompatibilities with RFC4287. It
|
|
// returns an error.
|
|
func (i *InlineXHTMLContent) Check() error {
|
|
if i.Type != "xhtml" {
|
|
return fmt.Errorf("type attribute of inline xhtml content %v must be xhtml", i)
|
|
}
|
|
|
|
if err := i.XHTMLDiv.Check(); err != nil {
|
|
return fmt.Errorf("xhtml div element of inline xhtml content %v: %v", i, err)
|
|
}
|
|
|
|
return nil
|
|
}
|