Check if the type of contents is a composite media type
This commit is contained in:
parent
6322566a54
commit
987feb8226
@ -1,5 +1,7 @@
|
||||
package atomfeed
|
||||
|
||||
import "errors"
|
||||
|
||||
type InlineOtherContent struct {
|
||||
*CommonAttributes
|
||||
Type MediaType `xml:"type,attr,omitempty"`
|
||||
@ -12,4 +14,10 @@ func (i *InlineOtherContent) hasSRC() bool { return false }
|
||||
|
||||
func (i *InlineOtherContent) getType() string { return string(i.Type) }
|
||||
|
||||
func (i *InlineOtherContent) Check() error { return nil }
|
||||
func (i *InlineOtherContent) Check() error {
|
||||
if isCompositeMediaType(i.getType()) {
|
||||
return errors.New("type attribute of inline other content must not be a composite type")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -15,6 +15,10 @@ func (o *OutOfLineContent) hasSRC() bool { return true }
|
||||
func (o *OutOfLineContent) getType() string { return string(o.Type) }
|
||||
|
||||
func (o *OutOfLineContent) Check() error {
|
||||
if isCompositeMediaType(o.getType()) {
|
||||
return errors.New("type attribute of out of line content must not be a composite type")
|
||||
}
|
||||
|
||||
if o.SRC == "" {
|
||||
return errors.New("src attribute of out of line content empty")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user