當前位置: 首頁>>代碼示例>>Golang>>正文


Golang extension.InitExtension函數代碼示例

本文整理匯總了Golang中github.com/apognu/xml/feed/extension.InitExtension函數的典型用法代碼示例。如果您正苦於以下問題:Golang InitExtension函數的具體用法?Golang InitExtension怎麽用?Golang InitExtension使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了InitExtension函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: ProcessStartElement

func (t *TextConstruct) ProcessStartElement(el xmlutils.StartElement) (xmlutils.Visitor, xmlutils.ParserError) {
	t.name = el.Name.Local
	t.Extension = extension.InitExtension(t.name, t.Extension.Manager)
	t.reset()

	for _, attr := range el.Attr {
		switch attr.Name.Space {
		case xmlutils.XML_NS:
			t.ProcessAttr(attr)

		case "":
			if attr.Name.Local == "type" {
				t.Type = attr.Value
				break
			}
		default:
			t.Extension.ProcessAttr(attr, t)
		}
	}

	switch t.Type {
	case "text", "html":
		t.PlainText.Parent = t
		return t.PlainText, nil

	case "xhtml":
		t.XHTML.Parent = t
		return t.XHTML, nil
	}

	return t.PlainText, nil
}
開發者ID:apognu,項目名稱:xml,代碼行數:32,代碼來源:textconstruct.go

示例2: NewChannelExt

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
}
開發者ID:apognu,項目名稱:xml,代碼行數:28,代碼來源:channel.go

示例3: NewCloudExt

func NewCloudExt(manager extension.Manager) *Cloud {
	c := NewCloud()

	c.Extension = extension.InitExtension("cloud", manager)

	return c
}
開發者ID:apognu,項目名稱:xml,代碼行數:7,代碼來源:cloud.go

示例4: NewBasicElementExt

func NewBasicElementExt(manager extension.Manager) *BasicElement {
	b := NewBasicElement()

	b.Extension = extension.InitExtension("basicelement", manager)

	return b
}
開發者ID:apognu,項目名稱:xml,代碼行數:7,代碼來源:basicelement.go

示例5: NewIdExt

func NewIdExt(manager extension.Manager) *Id {
	i := NewId()

	i.Extension = extension.InitExtension("id", manager)

	return i
}
開發者ID:apognu,項目名稱:xml,代碼行數:7,代碼來源:id.go

示例6: NewDateExt

func NewDateExt(manager extension.Manager) *Date {
	d := NewDate()

	d.Extension = extension.InitExtension("date", manager)

	return d
}
開發者ID:apognu,項目名稱:xml,代碼行數:7,代碼來源:dateconstruct.go

示例7: NewDateExt

func NewDateExt(manager extension.Manager) *Date {
	d := NewDate()
	d.depth.SetMaxDepth(1)
	d.Extension = extension.InitExtension("date", manager)

	return d
}
開發者ID:apognu,項目名稱:xml,代碼行數:7,代碼來源:date.go

示例8: newWrapperExt

func newWrapperExt(manager extension.Manager) *wrapper {
	w := newWrapper()

	w.Extensions = extension.InitExtension("__", manager)

	return w
}
開發者ID:apognu,項目名稱:xml,代碼行數:7,代碼來源:wrapper.go

示例9: NewPersonExt

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
}
開發者ID:apognu,項目名稱:xml,代碼行數:13,代碼來源:personconstruct.go

示例10: NewImageExt

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
}
開發者ID:apognu,項目名稱:xml,代碼行數:15,代碼來源:image.go

示例11: ProcessStartElement

func (b *BasicElement) ProcessStartElement(el xmlutils.StartElement) (xmlutils.Visitor, xmlutils.ParserError) {
	if b.depth.IsRoot() {
		b.name = el.Name
		b.Extension = extension.InitExtension(b.name.Local, b.Extension.Manager)

		for _, attr := range el.Attr {
			b.Extension.ProcessAttr(attr, b)
		}
	}

	if b.depth.Down() == xmlutils.MaxDepthReached {
		return b, xmlutils.NewError(LeafElementHasChild, fmt.Sprintf("'%s' shoud not have childs", b.Name))
	}

	return b, nil
}
開發者ID:apognu,項目名稱:xml,代碼行數:16,代碼來源:basicelement.go

示例12: NewSourceExt

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
}
開發者ID:apognu,項目名稱:xml,代碼行數:19,代碼來源:source.go

示例13: NewFeedExt

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
}
開發者ID:apognu,項目名稱:xml,代碼行數:19,代碼來源:feed.go

示例14: NewEntryExt

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
}
開發者ID:apognu,項目名稱:xml,代碼行數:19,代碼來源:entry.go

示例15: NewItemExt

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
}
開發者ID:apognu,項目名稱:xml,代碼行數:20,代碼來源:item.go


注:本文中的github.com/apognu/xml/feed/extension.InitExtension函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。