Added more error handling and necessary functions
This commit is contained in:
17
xhtmlText.go
17
xhtmlText.go
@@ -1,6 +1,8 @@
|
||||
package atom
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type XHTMLText struct {
|
||||
*CommonAttributes
|
||||
@@ -11,6 +13,19 @@ type XHTMLText struct {
|
||||
// isText checks whether the XHTMLText is a Text. It returns a bool.
|
||||
func (x *XHTMLText) isText() bool { return true }
|
||||
|
||||
// newPlainText creates a new PlainText. It returns a *PlainText and an error.
|
||||
func newXHTMLText(textType, content string) (*XHTMLText, error) {
|
||||
xhtmlDiv, err := NewXHTMLDiv(content)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating new xhtml text: %v", err)
|
||||
}
|
||||
|
||||
return &XHTMLText{
|
||||
Type: textType,
|
||||
XHTMLDiv: xhtmlDiv,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Check checks the XHTMLText for incompatibilities with RFC4287. It returns an
|
||||
// error.
|
||||
func (x *XHTMLText) Check() error {
|
||||
|
Reference in New Issue
Block a user