本文整理匯總了Golang中ru/kovalkov/xmltextreader.XmlTextReaderPtr.HasAttributes方法的典型用法代碼示例。如果您正苦於以下問題:Golang XmlTextReaderPtr.HasAttributes方法的具體用法?Golang XmlTextReaderPtr.HasAttributes怎麽用?Golang XmlTextReaderPtr.HasAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ru/kovalkov/xmltextreader.XmlTextReaderPtr
的用法示例。
在下文中一共展示了XmlTextReaderPtr.HasAttributes方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: processBody
func processBody(reader *xmltextreader.XmlTextReaderPtr, tag string, currentPointer string, c chan *Word) {
currentElementNum := 0
res := reader.Read()
eventType := reader.NodeType()
if currentPointer == "/1" {
currentElementNum = 1
}
for !(xmltextreader.XML_END_ELEMENT == eventType && tag == reader.Name()) && -1 != res {
name := reader.Name()
if xmltextreader.XML_START_ELEMENT == eventType {
currentElementNum += 1
if paragraph_tag == name || text_author_tag == name || subtitle_tag == name || verse_tag == name {
getParaToTagEnd(reader, name, currentPointer+"/"+strconv.Itoa(currentElementNum), 1, c)
} else if body_tag == name {
hasAttr, err := reader.HasAttributes()
if nil == err && hasAttr == false {
processBody(reader, name, currentPointer+"/"+strconv.Itoa(currentElementNum), c)
}
} else if section_tag == name {
hasAttr, err := reader.HasAttributes()
if nil == err && hasAttr {
// Skip section with id attr, notes definitions
getParaToTagEnd(reader, name, "", 1, c)
} else {
processBody(reader, name, currentPointer+"/"+strconv.Itoa(currentElementNum), c)
}
} else if title_tag == name || epigraph_tag == name {
processBody(reader, name, currentPointer+"/"+strconv.Itoa(currentElementNum), c)
}
}
res = reader.Read()
eventType = reader.NodeType()
}
}