func (t *TextConstruct) Validate() xmlutils.ParserError { err := utils.NewErrorAggregator() t.ValidateCommonAttributes(t.name, &err) return err.ErrorObject() }
func (d *Date) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() d.Extension.Validate(&error) return error.ErrorObject() }
func (o *OutOfLineContent) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("out of line", &error, o.Type, o.Src) return error.ErrorObject() }
func (u *UnescapedContent) Validate() xmlutils.ParserError { error := utils.NewErrorAggregator() u.Extension.Validate(&error) return error.ErrorObject() }
func (i *InReplyTo) Validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("in-reply-to", &error, i.Ref, i.Href, i.Source, i.Type) return error.ErrorObject() }
func (i *InlineOtherContent) ProcessStartElement(el xmlutils.StartElement) (xmlutils.Visitor, xmlutils.ParserError) { err := utils.NewErrorAggregator() if i.depth.IsRoot() { for _, attr := range el.Attr { switch attr.Name.Local { case "type": i.Type.Value = attr.Value i.Type.IncOccurence() } } } else { if error := i.Encoder.EncodeToken(el); error != nil { err.NewError(xmlutils.NewError(XHTMLEncodeToStringError, "cannot encode XHTML")) } if i.depth.Level > 0 { i.hasChild = true } } i.depth.Down() return i, nil }
func (s *Source) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("source", &error, s.Url) s.Extension.Validate(&error) return error.ErrorObject() }
func (e *Enclosure) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("enclosure", &error, e.Url, e.Length, e.Type) e.Extension.Validate(&error) return error.ErrorObject() }
func (c *Channel) validate() xmlutils.ParserError { err := utils.NewErrorAggregator() xmlutils.ValidateOccurenceCollection("channel", &err, c.Occurences) c.Extension.Validate(&err) return err.ErrorObject() }
func (d *Date) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() d.Extension.Validate(&error) d.ValidateCommonAttributes("date", &error) return error.ErrorObject() }
func (c *Category) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("category", &error, c.Domain) c.Extension.Validate(&error) return error.ErrorObject() }
func (c *Content) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() c.Extension.Validate(&error) c.ValidateCommonAttributes("content", &error) return error.ErrorObject() }
func (i *Image) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("image", &error, i.Url.Content, i.Title.Content, i.Link.Content, i.Width.Content, i.Height.Content, i.Description.Content) i.Extension.Validate(&error) return error.ErrorObject() }
func (c *Cloud) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("cloud", &error, c.Domain, c.Port, c.Path, c.RegisterProcedure, c.Protocol) c.Extension.Validate(&error) return error.ErrorObject() }
func (g *Guid) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("guid", &error, g.IsPermalink) g.Extension.Validate(&error) return error.ErrorObject() }
func (l *Logo) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElement("logo", l.Iri, &error) l.ValidateCommonAttributes("logo", &error) l.Extension.Validate(&error) return error.ErrorObject() }
func (l *Link) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("link", &error, l.Href, l.Rel, l.Type, l.HrefLang, l.Title, l.Length) l.Extension.Validate(&error) l.ValidateCommonAttributes("link", &error) return error.ErrorObject() }
func (i *Icon) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElement("icon", i.Iri, &error) i.Extension.Validate(&error) i.ValidateCommonAttributes("icon", &error) return error.ErrorObject() }
func (g *Generator) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("generator", &error, g.Uri, g.Version) g.Extension.Validate(&error) g.ValidateCommonAttributes("generator", &error) return error.ErrorObject() }
func (c *Category) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("category", &error, c.Term, c.Label, c.Scheme) c.ValidateCommonAttributes("category", &error) c.Extension.Validate(&error) return error.ErrorObject() }
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() }
func (p *Person) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateOccurences(p.name, &error, p.Name.Content.Occurence, p.Uri.Content.Occurence, p.Email.Content.Occurence) p.ValidateCommonAttributes(p.name, &error) p.Extension.Validate(&error) return error.ErrorObject() }
func (b *BasicElement) Validate() xmlutils.ParserError { error := utils.NewErrorAggregator() b.Extension.Validate(&error) if err := b.Content.Validate(); err != nil { error.NewError(xmlutils.NewError(err.Flag(), fmt.Sprintf("%s's %s", b.name.Local, err.Msg()))) } return error.ErrorObject() }
func (i *InlineOtherContent) validate() xmlutils.ParserError { error := utils.NewErrorAggregator() xmlutils.ValidateElements("inlineothercontent", &error, i.Type) if strings.HasPrefix(i.Type.Value, "text/") && i.hasChild { error.NewError(xmlutils.NewError(LeafElementHasChild, "text content should not have child")) } return error.ErrorObject() }
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() }
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() }
func (u *Updated) Validate() xmlutils.ParserError { errAgg := utils.NewErrorAggregator() link, ok := u.Parent.(*atom.Link) if !ok { errAgg.NewError(xmlutils.NewError(NotInLinkElement, "updated attr should be placed in link element")) } else { if link.Rel.String() != "replies" { errAgg.NewError(xmlutils.NewError(LinkNotReplies, "link element should avec a 'replies' rel for this extension")) } } return errAgg.ErrorObject() }
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() }
func (c *Count) Validate() xmlutils.ParserError { errAgg := utils.NewErrorAggregator() link, ok := c.Parent.(*atom.Link) if !ok { errAgg.NewError(xmlutils.NewError(NotInLinkElement, "count attr should be placed in link element")) } else { if link.Rel.String() != "replies" { errAgg.NewError(xmlutils.NewError(LinkNotReplies, "link element should avec a 'replies' rel for this extension")) } } if err := c.Validator(c.Name().Local, c.Content); err != nil { errAgg.NewError(err) } return errAgg.ErrorObject() }
func (i *InlineXHTMLContent) ProcessStartElement(el xmlutils.StartElement) (xmlutils.Visitor, xmlutils.ParserError) { err := utils.NewErrorAggregator() if i.depth.Level == 0 && el.Name.Local != "div" { err.NewError(xmlutils.NewError(XHTMLRootNodeNotDiv, "Inline XHTML root node must be a div")) } if i.completed == true { err.NewError(xmlutils.NewError(NotUniqueChild, "Inline XHTML should be contained in a unique node")) } i.depth.Down() if error := i.CheckXHTMLSpace(el); error != nil { err.NewError(error) } if error := i.EncodeXHTMLToken(el); error != nil { err.NewError(xmlutils.NewError(XHTMLEncodeToStringError, "cannot encode XHTML")) } return i, err.ErrorObject() }