本文整理匯總了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
}