• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang extension.InitExtension函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/apognu/xml/feed/extension.InitExtension函数的典型用法代码示例。如果您正苦于以下问题:Golang InitExtension函数的具体用法?Golang InitExtension怎么用?Golang InitExtension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了InitExtension函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: ProcessStartElement

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

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

	err := utils.NewErrorAggregator()

	u.depth.Down()

	if error := u.EncodeXHTMLToken(el); error != nil {
		err.NewError(xmlutils.NewError(XHTMLEncodeToStringError, "cannot encode XHTML"))
	}

	return u, err.ErrorObject()
}
开发者ID:apognu,项目名称:xml,代码行数:20,代码来源:unescaped.go


示例17: ProcessStartElement

func (p *Person) ProcessStartElement(el xmlutils.StartElement) (xmlutils.Visitor, xmlutils.ParserError) {
	if p.depth.IsRoot() {
		p.reset()
		p.name = el.Name.Local
		p.Extension = extension.InitExtension(p.name, p.Extension.Manager)
		for _, attr := range el.Attr {
			if !p.ProcessAttr(attr) {
				p.Extension.ProcessAttr(attr, p)
			}
		}

	}

	switch el.Name.Space {
	case "", "http://www.w3.org/2005/atom":
		switch el.Name.Local {
		case "name":
			p.Name.Content.IncOccurence()
			p.Name.Reset()
			return p.Name.ProcessStartElement(el)
		case "uri":
			p.Uri.Content.IncOccurence()
			p.Uri.Reset()
			return p.Uri.ProcessStartElement(el)
		case "email":
			p.Email.Content.IncOccurence()
			p.Email.Reset()
			return p.Email.ProcessStartElement(el)
		}
	default:
		return p.Extension.ProcessElement(el, p)
	}

	p.depth.Down()

	return p, nil
}
开发者ID:apognu,项目名称:xml,代码行数:37,代码来源:personconstruct.go


示例18: NewEnclosureExt

func NewEnclosureExt(manager extension.Manager) *Enclosure {
	e := NewEnclosure()
	e.Extension = extension.InitExtension("enclosure", manager)

	return e
}
开发者ID:apognu,项目名称:xml,代码行数:6,代码来源:enclosure.go


示例19: NewTextConstructExt

func NewTextConstructExt(manager extension.Manager) *TextConstruct {
	t := NewTextConstruct()

	t.Extension = extension.InitExtension("textconstruct", manager)
	return t
}
开发者ID:apognu,项目名称:xml,代码行数:6,代码来源:textconstruct.go


示例20: NewCategoryExt

func NewCategoryExt(manager extension.Manager) *Category {
	c := NewCategory()
	c.Extension = extension.InitExtension("category", manager)

	return c
}
开发者ID:apognu,项目名称:xml,代码行数:6,代码来源:category.go



注:本文中的github.com/apognu/xml/feed/extension.InitExtension函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang utils.NewDepthWatcher函数代码示例发布时间:2022-05-24
下一篇:
Golang errors.NewNotFoundError函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap