本文整理匯總了Python中util.ElementHelper.remove_element方法的典型用法代碼示例。如果您正苦於以下問題:Python ElementHelper.remove_element方法的具體用法?Python ElementHelper.remove_element怎麽用?Python ElementHelper.remove_element使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類util.ElementHelper
的用法示例。
在下文中一共展示了ElementHelper.remove_element方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: CleanTreeByMark
# 需要導入模塊: from util import ElementHelper [as 別名]
# 或者: from util.ElementHelper import remove_element [as 別名]
def CleanTreeByMark(element):
mark = long(element.get(kg_mark))
if 0==mark:
ElementHelper.remove_element(element)
elif 1==mark:
return
else:
for child in element:
CleanTreeByMark(child)
示例2: set_element_attribute
# 需要導入模塊: from util import ElementHelper [as 別名]
# 或者: from util.ElementHelper import remove_element [as 別名]
def set_element_attribute(element, x, y):
""" x is level of element, y is PreOrder number
"""
#set_element_coordinate
element.set(px,str(x))
element.set(py, str(y[0]))
y[0] += 1
#set element record, it mark whether an element is ancestor node of a record
element.set(kg_record_mark, '0')
#kg_text_mark mark whether an element belong to main text part
element.set(kg_text_mark, '0')
#set element .text and .tail
element.tail = normalize_word(element.tail)
element.text = normalize_word(element.text)
if len(element)==0 and len(element.tail)==0 and len(element.text)==0:
ElementHelper.remove_element(element)
for child in element:
set_element_attribute(child, x+1, y)
示例3: remove_nontext_element
# 需要導入模塊: from util import ElementHelper [as 別名]
# 或者: from util.ElementHelper import remove_element [as 別名]
def remove_nontext_element(element):
if element.get(kg_text_mark, '0') == '0':
ElementHelper.remove_element(element)
for child in element:
remove_nontext_element(child)