本文整理匯總了Golang中github.com/kpmy/ot/otm.Object.FindByQualident方法的典型用法代碼示例。如果您正苦於以下問題:Golang Object.FindByQualident方法的具體用法?Golang Object.FindByQualident怎麽用?Golang Object.FindByQualident使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/kpmy/ot/otm.Object
的用法示例。
在下文中一共展示了Object.FindByQualident方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: traverse
func (w *Walker) traverse(o otm.Object) {
var (
this schema.Guide
skip *bool
skipped = func() {
s := true
skip = &s
}
important = func() {
s := false
skip = &s
}
)
switch o.Qualident().Class {
//structure elements
case "grammar":
skipped()
if start := o.FindByQualident(otm.Qualident{Template: "ng", Class: "start"}); start != nil {
w.forEach(start[0], traverseWrap())
}
case "ref":
skipped()
panic(0)
/* if ref := w.root.FindByName(n.Name); ref != nil {
if cached := w.cache[n.Name]; cached == nil {
this = Construct(n.XMLName)
{
std.NameAttr(this, n.Name)
//std.RefAttr(this, cached.root)
}
w.cache[n.Name] = &Cached{node: ref, root: this}
w.GrowDown(this)
w.forEach(ref, traverseWrap())
w.Up()
} else {
w.Grow(cached.root)
}
} else {
halt.As(100, "ref not found", n.Name)
}
*/
//content elements
case "element", "attribute", "data", "text", "value", "name", "param":
fallthrough
//constraint elements
case "choice", "interleave", "optional", "zeroOrMore", "oneOrMore", "group", "list", "mixed", "except", "anyName", "nsName", "empty", "externalRef":
important()
this = Construct(o.Qualident())
{
std.NameAttr(this, NameOf(o))
/*std.CharDataAttr(this, n.Data())
std.TypeAttr(this, n.Type)
std.NSAttr(this, n.NS)
std.DataTypeAttr(this, n.DataType)
std.CombineAttr(this, n.Combine)
std.HrefAttr(this, n.Href)
*/
}
w.GrowDown(this)
w.forEach(o, traverseWrap())
w.Up()
//skipped elements
case "description": //descriprion do nothing
default:
halt.As(100, o.Qualident())
}
if skip != nil {
assert.For(*skip || this != nil, 60, "no result for ", o.Qualident())
} else if this == nil {
log.Println("unhandled", o.Qualident())
}
}