Exemple #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
}
Exemple #2
0
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
}
Exemple #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
}
Exemple #4
0
func NewDate() *Date {
	d := Date{depth: xmlutils.NewDepthWatcher()}
	d.depth.SetMaxDepth(1)
	d.InitCommonAttributes()

	return &d
}
Exemple #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
}
Exemple #6
0
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
}
Exemple #7
0
func NewBasicElement(parent xmlutils.Visitor) *BasicElement {
	b := BasicElement{Parent: parent, depth: xmlutils.NewDepthWatcher()}
	b.depth.SetMaxDepth(1)

	b.InitCommonAttributes()

	return &b
}
Exemple #8
0
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
}
Exemple #9
0
func NewIcon() *Icon {
	i := Icon{depth: xmlutils.NewDepthWatcher()}

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

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

	return &i
}
Exemple #10
0
Fichier : id.go Projet : apognu/xml
func NewId() *Id {
	i := Id{depth: xmlutils.NewDepthWatcher()}

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

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

	return &i
}
Exemple #11
0
func NewLogo() *Logo {
	l := Logo{depth: xmlutils.NewDepthWatcher()}

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

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

	return &l
}
Exemple #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
}
Exemple #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
}
Exemple #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
}
Exemple #15
0
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
}
Exemple #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
}
Exemple #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
}
Exemple #18
0
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
}
Exemple #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
}
Exemple #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
}
Exemple #21
0
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
}
Exemple #22
0
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
}
Exemple #23
0
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
}
Exemple #24
0
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
}
Exemple #25
0
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
}
Exemple #26
0
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
}
Exemple #27
0
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
}
Exemple #28
0
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
}
Exemple #29
0
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
}
Exemple #30
0
func NewInlineXHTMLContent() *InlineXHTMLContent {
	i := InlineXHTMLContent{depth: xmlutils.NewDepthWatcher(), completed: false}
	i.Content = &bytes.Buffer{}
	i.Encoder = xml.NewEncoder(i.Content)
	return &i
}