本文整理汇总了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
}
示例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
}
示例3: NewCloudExt
func NewCloudExt(manager extension.Manager) *Cloud {
c := NewCloud()
c.Extension = extension.InitExtension("cloud", manager)
return c
}
示例4: NewBasicElementExt
func NewBasicElementExt(manager extension.Manager) *BasicElement {
b := NewBasicElement()
b.Extension = extension.InitExtension("basicelement", manager)
return b
}
示例5: NewIdExt
func NewIdExt(manager extension.Manager) *Id {
i := NewId()
i.Extension = extension.InitExtension("id", manager)
return i
}
示例6: NewDateExt
func NewDateExt(manager extension.Manager) *Date {
d := NewDate()
d.Extension = extension.InitExtension("date", manager)
return d
}
示例7: NewDateExt
func NewDateExt(manager extension.Manager) *Date {
d := NewDate()
d.depth.SetMaxDepth(1)
d.Extension = extension.InitExtension("date", manager)
return d
}
示例8: newWrapperExt
func newWrapperExt(manager extension.Manager) *wrapper {
w := newWrapper()
w.Extensions = extension.InitExtension("__", manager)
return w
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}