Beispiel #1
0
func (c *Channel) validate() xmlutils.ParserError {
	err := utils.NewErrorAggregator()

	xmlutils.ValidateOccurenceCollection("channel", &err, c.Occurences)
	c.Extension.Validate(&err)

	return err.ErrorObject()
}
Beispiel #2
0
func (s *Source) validate() xmlutils.ParserError {
	error := utils.NewErrorAggregator()

	xmlutils.ValidateOccurenceCollection("source", &error, s.Occurences)
	s.Extension.Validate(&error)
	s.validateLinks(&error)
	s.ValidateCommonAttributes("source", &error)

	return error.ErrorObject()
}
Beispiel #3
0
func (i *Item) validate() xmlutils.ParserError {
	err := utils.NewErrorAggregator()

	xmlutils.ValidateOccurenceCollection("item", &err, i.Occurences)
	i.Extension.Validate(&err)

	if i.Occurences.Count("description") == 0 && i.Occurences.Count("title") == 0 {
		err.NewError(xmlutils.NewError(MissingAttribute, "item should have at least a title or a description"))
	}

	return err.ErrorObject()
}
Beispiel #4
0
func (f *Feed) validate() xmlutils.ParserError {
	error := utils.NewErrorAggregator()

	xmlutils.ValidateOccurenceCollection("feed", &error, f.Occurences)
	f.Extension.Validate(&error)

	f.validateLinks(&error)
	f.validateAuthors(&error)
	f.validateEntries(&error)
	f.ValidateCommonAttributes("feed", &error)

	return error.ErrorObject()
}
Beispiel #5
0
func (e *Entry) validate() xmlutils.ParserError {
	error := utils.NewErrorAggregator()

	e.validateLinks(&error)
	e.validateAuthors(&error)
	xmlutils.ValidateOccurenceCollection("entry", &error, e.Occurences)
	e.Extension.Validate(&error)
	e.ValidateCommonAttributes("entry", &error)

	if e.Occurences.Count("summary") == 0 && !e.Content.HasReadableContent() {
		error.NewError(xmlutils.NewError(MissingSummary, "Summary must be provided or Content must contain XML media type, XHTML or text"))
	}

	return error.ErrorObject()
}
Beispiel #6
0
func (v *VisitorExtension) Validate(errorAgg *utils.ErrorAggregator) {
	xmlutils.ValidateOccurenceCollection(v.name, errorAgg, v.Store.Occ)
	v.Store.Validate(errorAgg)
}