本文整理汇总了Golang中github.com/skriptble/nine/element.Element.ChildElements方法的典型用法代码示例。如果您正苦于以下问题:Golang Element.ChildElements方法的具体用法?Golang Element.ChildElements怎么用?Golang Element.ChildElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/skriptble/nine/element.Element
的用法示例。
在下文中一共展示了Element.ChildElements方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TransformPresence
func TransformPresence(el element.Element) (Presence, error) {
if el.Tag != "presence" {
return Presence{}, ErrNotPresence
}
presence := Presence{}
presence.To = el.SelectAttrValue("to", "")
presence.From = el.SelectAttrValue("from", "")
presence.ID = el.SelectAttrValue("id", "")
presence.Type = el.SelectAttrValue("type", "")
presence.Lang = el.SelectAttrValue("xml:lang", "")
presence.Data = el.Text()
presence.Children = el.ChildElements()
presence.Tag, presence.Space = el.Tag, el.Space
return presence, nil
}
示例2: TransformIQ
func TransformIQ(el element.Element) IQ {
if el.Tag != "iq" {
return IQEmpty
}
iq := IQ{}
iq.To = el.SelectAttrValue("to", "")
iq.From = el.SelectAttrValue("from", "")
iq.ID = el.SelectAttrValue("id", "")
iq.Type = el.SelectAttrValue("type", "")
iq.Lang = el.SelectAttrValue("xml:lang", "")
iq.Data = el.Text()
iq.Children = el.ChildElements()
iq.Tag, iq.Space = el.Tag, el.Space
return iq
}
示例3: TransformMessage
func TransformMessage(el element.Element) (Message, error) {
if el.Tag != "message" {
return Message{}, ErrNotMessage
}
message := Message{}
message.To = el.SelectAttrValue("to", "")
message.From = el.SelectAttrValue("from", "")
message.ID = el.SelectAttrValue("id", "")
message.Type = el.SelectAttrValue("type", "")
message.Lang = el.SelectAttrValue("xml:lang", "")
message.Data = el.Text()
message.Children = el.ChildElements()
message.Tag, message.Space = el.Tag, el.Space
return message, nil
}
示例4: HandleElement
// HandleElement handles the stream:features element. It finds the
// FeatureHandler to call for the given feature children elements invokes it.
func (fm FeaturesMux) HandleElement(el element.Element, p Properties) ([]element.Element, Properties) {
children := el.ChildElements()
h, elem := fm.Handler(children)
return h.HandleFeature(elem, p)
}