Ejemplo n.º 1
0
Archivo: feed.go Proyecto: apognu/xml
func (f *Feed) init() {

	f.Generator.Parent = f
	f.Icon.Parent = f
	f.Id.Parent = f
	f.Logo.Parent = f
	f.Rights.Parent = f
	f.Subtitle.Parent = f
	f.Title.Parent = f
	f.Updated.Parent = f

	f.InitCommonAttributes()

	f.Occurences = xmlutils.NewOccurenceCollection(
		xmlutils.NewOccurence("generator", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("icon", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("logo", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("id", xmlutils.ExistsAndUniqueValidator(MissingId, IdDuplicated)),
		xmlutils.NewOccurence("rights", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("subtitle", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("title", xmlutils.ExistsAndUniqueValidator(MissingTitle, TitleDuplicated)),
		xmlutils.NewOccurence("updated", xmlutils.ExistsAndUniqueValidator(MissingDate, AttributeDuplicated)),
	)

}
Ejemplo n.º 2
0
Archivo: item.go Proyecto: apognu/xml
func (i *Item) init() {

	i.Title.Content = xmlutils.NewElement("title", "", xmlutils.Nop)
	i.Link.Content = xmlutils.NewElement("link", "", xmlutils.Nop)
	i.Author.Content = xmlutils.NewElement("author", "", xmlutils.Nop)
	i.Comments.Content = xmlutils.NewElement("comments", "", xmlutils.Nop)

	i.Title.Parent = i
	i.Link.Parent = i
	i.Description.Parent = i
	i.Author.Parent = i
	i.Comments.Parent = i
	i.Enclosure.Parent = i
	i.Guid.Parent = i
	i.PubDate.Parent = i
	i.Source.Parent = i

	i.Occurences = xmlutils.NewOccurenceCollection(
		xmlutils.NewOccurence("title", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("link", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("description", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("author", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("comments", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("enclosure", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("guid", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("pubdate", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("source", xmlutils.UniqueValidator(AttributeDuplicated)),
	)
}
Ejemplo n.º 3
0
Archivo: entry.go Proyecto: apognu/xml
func (e *Entry) init() {

	e.Content.Parent = e
	e.Id.Parent = e
	e.Published.Parent = e
	e.Rights.Parent = e
	e.Source.Parent = e
	e.Summary.Parent = e
	e.Title.Parent = e
	e.Updated.Parent = e

	e.InitCommonAttributes()

	e.Occurences = xmlutils.NewOccurenceCollection(
		xmlutils.NewOccurence("content", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("id", xmlutils.ExistsAndUniqueValidator(MissingId, IdDuplicated)),
		xmlutils.NewOccurence("published", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("rights", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("source", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("summary", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("title", xmlutils.ExistsAndUniqueValidator(MissingTitle, TitleDuplicated)),
		xmlutils.NewOccurence("updated", xmlutils.ExistsAndUniqueValidator(MissingDate, AttributeDuplicated)),
	)

}
Ejemplo n.º 4
0
func (c *Channel) init() {

	c.Title.Content = xmlutils.NewElement("title", "", xmlutils.Nop)
	c.Link.Content = xmlutils.NewElement("link", "", IsValidIRI)
	c.Language.Content = xmlutils.NewElement("language", "", xmlutils.Nop)
	c.Copyright.Content = xmlutils.NewElement("copyright", "", xmlutils.Nop)
	c.ManagingEditor.Content = xmlutils.NewElement("managingeditor", "", xmlutils.Nop)
	c.Webmaster.Content = xmlutils.NewElement("webmaster", "", xmlutils.Nop)
	c.Generator.Content = xmlutils.NewElement("generator", "", xmlutils.Nop)
	c.Docs.Content = xmlutils.NewElement("docs", "", xmlutils.Nop)
	c.Ttl.Content = xmlutils.NewElement("ttl", "", xmlutils.Nop)
	c.Rating.Content = xmlutils.NewElement("rating", "", xmlutils.Nop)
	c.SkipHours.Content = xmlutils.NewElement("skiphours", "", xmlutils.Nop)
	c.SkipDays.Content = xmlutils.NewElement("skipdays", "", xmlutils.Nop)

	c.Title.Parent = c
	c.Link.Parent = c
	c.Description.Parent = c
	c.Language.Parent = c
	c.Copyright.Parent = c
	c.ManagingEditor.Parent = c
	c.Webmaster.Parent = c
	c.PubDate.Parent = c
	c.LastBuildDate.Parent = c
	c.Generator.Parent = c
	c.Docs.Parent = c
	c.Cloud.Parent = c
	c.Ttl.Parent = c
	c.Image.Parent = c
	c.Rating.Parent = c
	c.SkipHours.Parent = c
	c.SkipDays.Parent = c

	c.Occurences = xmlutils.NewOccurenceCollection(
		xmlutils.NewOccurence("title", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)),
		xmlutils.NewOccurence("link", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)),
		xmlutils.NewOccurence("description", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)),
		xmlutils.NewOccurence("language", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("copyright", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("managingeditor", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("webmaster", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("pubdate", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("lastbuilddate", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("generator", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("docs", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("cloud", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("ttl", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("image", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("rating", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("skiphours", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("skipdays", xmlutils.UniqueValidator(AttributeDuplicated)),
	)

}
Ejemplo n.º 5
0
Archivo: source.go Proyecto: apognu/xml
func (s *Source) init() {

	s.Generator.Parent = s
	s.Icon.Parent = s
	s.Id.Parent = s
	s.Logo.Parent = s
	s.Rights.Parent = s
	s.Subtitle.Parent = s
	s.Title.Parent = s
	s.Updated.Parent = s

	s.Occurences = xmlutils.NewOccurenceCollection(
		xmlutils.NewOccurence("generator", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("icon", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("logo", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("id", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)),
		xmlutils.NewOccurence("rights", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("subtitle", xmlutils.UniqueValidator(AttributeDuplicated)),
		xmlutils.NewOccurence("title", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)),
		xmlutils.NewOccurence("updated", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)),
	)

	s.InitCommonAttributes()
}