Exemplo n.º 1
0
func NewChannelExt(manager extension.Manager) *Channel {
	c := Channel{
		Title:          NewBasicElementExt(manager),
		Link:           NewBasicElementExt(manager),
		Description:    NewUnescapedContentExt(manager),
		Language:       NewBasicElementExt(manager),
		Copyright:      NewBasicElementExt(manager),
		ManagingEditor: NewBasicElementExt(manager),
		Webmaster:      NewBasicElementExt(manager),
		PubDate:        NewDateExt(manager),
		LastBuildDate:  NewDateExt(manager),
		Generator:      NewBasicElementExt(manager),
		Docs:           NewBasicElementExt(manager),
		Cloud:          NewCloudExt(manager),
		Ttl:            NewBasicElementExt(manager),
		Image:          NewImageExt(manager),
		Rating:         NewBasicElementExt(manager),
		SkipHours:      NewBasicElementExt(manager),
		SkipDays:       NewBasicElementExt(manager),

		depth: xmlutils.NewDepthWatcher(),
	}

	c.init()
	c.Extension = extension.InitExtension("channel", manager)

	return &c
}
Exemplo n.º 2
0
Arquivo: link.go Projeto: apognu/xml
func NewLink() *Link {
	l := Link{depth: xmlutils.NewDepthWatcher()}

	l.Href = xmlutils.NewElement("href", "", IsValidIRI)
	l.Href.SetOccurence(xmlutils.NewOccurence("href", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	l.Rel = xmlutils.NewElement("rel", "alternate", xmlutils.Nop)
	l.Rel.SetOccurence(xmlutils.NewOccurence("rel", xmlutils.UniqueValidator(AttributeDuplicated)))

	l.Type = xmlutils.NewElement("type", "", IsValidMIME)
	l.Type.SetOccurence(xmlutils.NewOccurence("type", xmlutils.UniqueValidator(AttributeDuplicated)))

	l.HrefLang = xmlutils.NewElement("hreflang", "", xmlutils.Nop)
	l.HrefLang.SetOccurence(xmlutils.NewOccurence("hreflang", xmlutils.UniqueValidator(AttributeDuplicated)))

	l.Title = xmlutils.NewElement("title", "", xmlutils.Nop)
	l.Title.SetOccurence(xmlutils.NewOccurence("title", xmlutils.UniqueValidator(AttributeDuplicated)))

	l.Length = xmlutils.NewElement("length", "", IsValidLength)
	l.Length.SetOccurence(xmlutils.NewOccurence("length", xmlutils.UniqueValidator(AttributeDuplicated)))

	l.InitCommonAttributes()

	return &l
}
Exemplo n.º 3
0
func NewChannel() *Channel {
	c := Channel{
		Title:          NewBasicElement(),
		Link:           NewBasicElement(),
		Description:    NewUnescapedContent(),
		Language:       NewBasicElement(),
		Copyright:      NewBasicElement(),
		ManagingEditor: NewBasicElement(),
		Webmaster:      NewBasicElement(),
		PubDate:        NewDate(),
		LastBuildDate:  NewDate(),
		Generator:      NewBasicElement(),
		Docs:           NewBasicElement(),
		Cloud:          NewCloud(),
		Ttl:            NewBasicElement(),
		Image:          NewImage(),
		Rating:         NewBasicElement(),
		SkipHours:      NewBasicElement(),
		SkipDays:       NewBasicElement(),

		depth: xmlutils.NewDepthWatcher(),
	}

	c.init()

	return &c
}
Exemplo n.º 4
0
func NewDate() *Date {
	d := Date{depth: xmlutils.NewDepthWatcher()}
	d.depth.SetMaxDepth(1)
	d.InitCommonAttributes()

	return &d
}
Exemplo n.º 5
0
func NewCategory() *Category {
	c := Category{depth: xmlutils.NewDepthWatcher()}

	c.Domain = xmlutils.NewElement("domain", "", xmlutils.Nop)
	c.Domain.SetOccurence(xmlutils.NewOccurence("domain", xmlutils.UniqueValidator(AttributeDuplicated)))

	return &c
}
Exemplo n.º 6
0
Arquivo: guid.go Projeto: apognu/xml
func NewGuid() *Guid {
	g := Guid{depth: xmlutils.NewDepthWatcher()}

	g.IsPermalink = xmlutils.NewElement("isPermalink", "true", xmlutils.Nop)
	g.IsPermalink.SetOccurence(xmlutils.NewOccurence("isPermalink", xmlutils.UniqueValidator(AttributeDuplicated)))

	return &g
}
Exemplo n.º 7
0
func NewBasicElement(parent xmlutils.Visitor) *BasicElement {
	b := BasicElement{Parent: parent, depth: xmlutils.NewDepthWatcher()}
	b.depth.SetMaxDepth(1)

	b.InitCommonAttributes()

	return &b
}
Exemplo n.º 8
0
Arquivo: source.go Projeto: apognu/xml
func NewSource() *Source {
	s := Source{depth: xmlutils.NewDepthWatcher()}

	s.Url = xmlutils.NewElement("url", "", xmlutils.Nop)
	s.Url.SetOccurence(xmlutils.NewOccurence("url", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	return &s
}
Exemplo n.º 9
0
Arquivo: icon.go Projeto: apognu/xml
func NewIcon() *Icon {
	i := Icon{depth: xmlutils.NewDepthWatcher()}

	i.Iri = xmlutils.NewElement("iri", "", IsValidIRI)

	i.InitCommonAttributes()
	i.depth.SetMaxDepth(1)

	return &i
}
Exemplo n.º 10
0
Arquivo: id.go Projeto: apognu/xml
func NewId() *Id {
	i := Id{depth: xmlutils.NewDepthWatcher()}

	i.Content = xmlutils.NewElement("iri", "", IsAbsoluteIRI)

	i.InitCommonAttributes()
	i.depth.SetMaxDepth(1)

	return &i
}
Exemplo n.º 11
0
Arquivo: logo.go Projeto: apognu/xml
func NewLogo() *Logo {
	l := Logo{depth: xmlutils.NewDepthWatcher()}

	l.Iri = xmlutils.NewElement("iri", "", IsValidIRI)

	l.InitCommonAttributes()
	l.depth.SetMaxDepth(1)

	return &l
}
Exemplo n.º 12
0
func NewPerson() *Person {
	p := Person{depth: xmlutils.NewDepthWatcher()}

	p.Name = NewBasicElement(&p)
	p.Uri = NewBasicElement(&p)
	p.Email = NewBasicElement(&p)

	p.init()

	return &p
}
Exemplo n.º 13
0
func NewOutOfLineContent() *OutOfLineContent {
	o := OutOfLineContent{depth: xmlutils.NewDepthWatcher()}

	o.Type = xmlutils.NewElement("type", "", outOfLineTypeIsValid)
	o.Type.SetOccurence(xmlutils.NewOccurence("type", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	o.Src = xmlutils.NewElement("src", "", IsValidIRI)
	o.Src.SetOccurence(xmlutils.NewOccurence("src", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	o.depth.SetMaxDepth(1)
	return &o
}
Exemplo n.º 14
0
func NewPersonExt(manager extension.Manager) *Person {
	p := Person{depth: xmlutils.NewDepthWatcher()}

	p.Name = NewBasicElementExt(&p, manager)
	p.Uri = NewBasicElementExt(&p, manager)
	p.Email = NewBasicElementExt(&p, manager)

	p.Extension = extension.InitExtension("person", manager)

	p.init()

	return &p
}
Exemplo n.º 15
0
Arquivo: image.go Projeto: apognu/xml
func NewImage() *Image {
	i := Image{depth: xmlutils.NewDepthWatcher()}

	i.Url = NewBasicElement()
	i.Title = NewBasicElement()
	i.Link = NewBasicElement()
	i.Width = NewBasicElement()
	i.Height = NewBasicElement()
	i.Description = NewBasicElement()

	i.init()

	return &i
}
Exemplo n.º 16
0
func NewEnclosure() *Enclosure {
	e := Enclosure{depth: xmlutils.NewDepthWatcher()}

	e.Url = xmlutils.NewElement("url", "", xmlutils.Nop)
	e.Url.SetOccurence(xmlutils.NewOccurence("url", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	e.Length = xmlutils.NewElement("length", "", xmlutils.Nop)
	e.Length.SetOccurence(xmlutils.NewOccurence("length", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	e.Type = xmlutils.NewElement("type", "", xmlutils.Nop)
	e.Type.SetOccurence(xmlutils.NewOccurence("type", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	return &e
}
Exemplo n.º 17
0
func NewGenerator() *Generator {
	g := Generator{depth: xmlutils.NewDepthWatcher()}

	g.Uri = xmlutils.NewElement("uri", "", IsValidIRI)
	g.Uri.SetOccurence(xmlutils.NewOccurence("uri", xmlutils.UniqueValidator(AttributeDuplicated)))

	g.Version = xmlutils.NewElement("version", "", xmlutils.Nop)
	g.Version.SetOccurence(xmlutils.NewOccurence("version", xmlutils.UniqueValidator(AttributeDuplicated)))

	g.InitCommonAttributes()

	g.depth.SetMaxDepth(1)
	return &g
}
Exemplo n.º 18
0
Arquivo: image.go Projeto: apognu/xml
func NewImageExt(manager extension.Manager) *Image {
	i := Image{depth: xmlutils.NewDepthWatcher()}

	i.Url = NewBasicElementExt(manager)
	i.Title = NewBasicElementExt(manager)
	i.Link = NewBasicElementExt(manager)
	i.Width = NewBasicElementExt(manager)
	i.Height = NewBasicElementExt(manager)
	i.Description = NewBasicElementExt(manager)

	i.init()
	i.Extension = extension.InitExtension("image", manager)

	return &i
}
Exemplo n.º 19
0
func NewCategory() *Category {
	c := Category{depth: xmlutils.NewDepthWatcher()}

	c.Term = xmlutils.NewElement("term", "", xmlutils.Nop)
	c.Term.SetOccurence(xmlutils.NewOccurence("term", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	c.Scheme = xmlutils.NewElement("scheme", "", IsValidIRI)
	c.Scheme.SetOccurence(xmlutils.NewOccurence("scheme", xmlutils.UniqueValidator(AttributeDuplicated)))

	c.Label = xmlutils.NewElement("label", "", xmlutils.Nop)
	c.Label.SetOccurence(xmlutils.NewOccurence("label", xmlutils.UniqueValidator(AttributeDuplicated)))

	c.InitCommonAttributes()

	return &c
}
Exemplo n.º 20
0
func newInReplyTo() *InReplyTo {
	i := InReplyTo{depth: xmlutils.NewDepthWatcher()}

	i.Ref = xmlutils.NewElement("ref", "", atom.IsAbsoluteIRI)
	i.Ref.SetOccurence(xmlutils.NewOccurence("ref", xmlutils.ExistsAndUniqueValidator(atom.MissingAttribute, atom.AttributeDuplicated)))

	i.Href = xmlutils.NewElement("href", "", atom.IsValidIRI)
	i.Href.SetOccurence(xmlutils.NewOccurence("href", xmlutils.UniqueValidator(atom.AttributeDuplicated)))

	i.Type = xmlutils.NewElement("type", "", xmlutils.Nop)
	i.Type.SetOccurence(xmlutils.NewOccurence("type", xmlutils.UniqueValidator(atom.AttributeDuplicated)))

	i.Source = xmlutils.NewElement("source", "", atom.IsValidIRI)
	i.Source.SetOccurence(xmlutils.NewOccurence("source", xmlutils.UniqueValidator(atom.AttributeDuplicated)))

	return &i
}
Exemplo n.º 21
0
Arquivo: source.go Projeto: apognu/xml
func NewSource() *Source {
	s := Source{
		Generator: NewGenerator(),
		Icon:      NewIcon(),
		Id:        NewId(),
		Logo:      NewLogo(),
		Rights:    NewTextConstruct(),
		Subtitle:  NewTextConstruct(),
		Title:     NewTextConstruct(),
		Updated:   NewDate(),

		depth: xmlutils.NewDepthWatcher(),
	}

	s.init()

	return &s
}
Exemplo n.º 22
0
Arquivo: feed.go Projeto: apognu/xml
func NewFeed() *Feed {
	f := Feed{
		Generator: NewGenerator(),
		Icon:      NewIcon(),
		Id:        NewId(),
		Logo:      NewLogo(),
		Rights:    NewTextConstruct(),
		Subtitle:  NewTextConstruct(),
		Title:     NewTextConstruct(),
		Updated:   NewDate(),

		depth: xmlutils.NewDepthWatcher(),
	}

	f.init()

	return &f
}
Exemplo n.º 23
0
Arquivo: entry.go Projeto: apognu/xml
func NewEntry() *Entry {
	e := Entry{
		Content:   NewContent(),
		Id:        NewId(),
		Published: NewDate(),
		Rights:    NewTextConstruct(),
		Source:    NewSource(),
		Summary:   NewTextConstruct(),
		Title:     NewTextConstruct(),
		Updated:   NewDate(),

		depth: xmlutils.NewDepthWatcher(),
	}

	e.init()

	return &e
}
Exemplo n.º 24
0
Arquivo: feed.go Projeto: apognu/xml
func NewFeedExt(manager extension.Manager) *Feed {
	f := Feed{
		Generator: NewGeneratorExt(manager),
		Icon:      NewIconExt(manager),
		Id:        NewIdExt(manager),
		Logo:      NewLogoExt(manager),
		Rights:    NewTextConstructExt(manager),
		Subtitle:  NewTextConstructExt(manager),
		Title:     NewTextConstructExt(manager),
		Updated:   NewDateExt(manager),

		depth: xmlutils.NewDepthWatcher(),
	}

	f.init()
	f.Extension = extension.InitExtension("feed", manager)

	return &f
}
Exemplo n.º 25
0
Arquivo: entry.go Projeto: apognu/xml
func NewEntryExt(manager extension.Manager) *Entry {
	e := Entry{
		Content:   NewContentExt(manager),
		Id:        NewIdExt(manager),
		Published: NewDateExt(manager),
		Rights:    NewTextConstructExt(manager),
		Source:    NewSourceExt(manager),
		Summary:   NewTextConstructExt(manager),
		Title:     NewTextConstructExt(manager),
		Updated:   NewDateExt(manager),

		depth: xmlutils.NewDepthWatcher(),
	}

	e.init()
	e.Extension = extension.InitExtension("entry", manager)

	return &e
}
Exemplo n.º 26
0
Arquivo: source.go Projeto: apognu/xml
func NewSourceExt(manager extension.Manager) *Source {
	s := Source{
		Generator: NewGeneratorExt(manager),
		Icon:      NewIconExt(manager),
		Id:        NewIdExt(manager),
		Logo:      NewLogoExt(manager),
		Rights:    NewTextConstructExt(manager),
		Subtitle:  NewTextConstructExt(manager),
		Title:     NewTextConstructExt(manager),
		Updated:   NewDateExt(manager),

		depth: xmlutils.NewDepthWatcher(),
	}

	s.init()
	s.Extension = extension.InitExtension("source", manager)

	return &s
}
Exemplo n.º 27
0
Arquivo: item.go Projeto: apognu/xml
func NewItem() *Item {
	i := Item{
		Title:       NewBasicElement(),
		Link:        NewBasicElement(),
		Description: NewUnescapedContent(),
		Author:      NewBasicElement(),
		Comments:    NewBasicElement(),
		Enclosure:   NewEnclosure(),
		Guid:        NewGuid(),
		PubDate:     NewDate(),
		Source:      NewSource(),

		depth: xmlutils.NewDepthWatcher(),
	}

	i.init()

	return &i
}
Exemplo n.º 28
0
Arquivo: cloud.go Projeto: apognu/xml
func NewCloud() *Cloud {
	c := Cloud{depth: xmlutils.NewDepthWatcher()}

	c.Domain = xmlutils.NewElement("domain", "", xmlutils.Nop)
	c.Domain.SetOccurence(xmlutils.NewOccurence("domain", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	c.Port = xmlutils.NewElement("port", "", xmlutils.Nop)
	c.Port.SetOccurence(xmlutils.NewOccurence("port", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	c.Path = xmlutils.NewElement("path", "", xmlutils.Nop)
	c.Path.SetOccurence(xmlutils.NewOccurence("path", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	c.RegisterProcedure = xmlutils.NewElement("registerProcedure", "", xmlutils.Nop)
	c.RegisterProcedure.SetOccurence(xmlutils.NewOccurence("registerProcedure", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	c.Protocol = xmlutils.NewElement("protocol", "", xmlutils.Nop)
	c.Protocol.SetOccurence(xmlutils.NewOccurence("protocol", xmlutils.ExistsAndUniqueValidator(MissingAttribute, AttributeDuplicated)))

	return &c
}
Exemplo n.º 29
0
Arquivo: item.go Projeto: apognu/xml
func NewItemExt(manager extension.Manager) *Item {
	i := Item{
		Title:       NewBasicElementExt(manager),
		Link:        NewBasicElementExt(manager),
		Description: NewUnescapedContentExt(manager),
		Author:      NewBasicElementExt(manager),
		Comments:    NewBasicElementExt(manager),
		Enclosure:   NewEnclosureExt(manager),
		Guid:        NewGuidExt(manager),
		PubDate:     NewDateExt(manager),
		Source:      NewSourceExt(manager),

		depth: xmlutils.NewDepthWatcher(),
	}

	i.init()
	i.Extension = extension.InitExtension("item", manager)

	return &i
}
Exemplo n.º 30
0
func NewInlineXHTMLContent() *InlineXHTMLContent {
	i := InlineXHTMLContent{depth: xmlutils.NewDepthWatcher(), completed: false}
	i.Content = &bytes.Buffer{}
	i.Encoder = xml.NewEncoder(i.Content)
	return &i
}