本文整理汇总了Python中Node.Node.wrap方法的典型用法代码示例。如果您正苦于以下问题:Python Node.wrap方法的具体用法?Python Node.wrap怎么用?Python Node.wrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node.Node
的用法示例。
在下文中一共展示了Node.wrap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createHTMLElement
# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import wrap [as 别名]
def createHTMLElement(doc, tag):
if isinstance(tag, BeautifulSoup.NavigableString):
return Node.wrap(doc, tag)
if log.ThugOpts.Personality.isIE():
if tag.name.lower() in ('t:animatecolor', ):
return TAnimateColor.TAnimateColor(doc, tag)
if tag.name.lower() in DOMImplementation.TAGS:
return DOMImplementation.TAGS[tag.name.lower()](doc, tag)
else:
return HTMLElement.HTMLElement(doc, tag)
示例2: previousSibling
# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import wrap [as 别名]
def previousSibling(self):
return Node.wrap(self.doc, self.tag.previous_sibling)
示例3: nextSibling
# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import wrap [as 别名]
def nextSibling(self):
return Node.wrap(self.doc, self.tag.next_sibling)
示例4: lastChild
# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import wrap [as 别名]
def lastChild(self):
return Node.wrap(self.doc, self.tag.contents[-1]) if len(self.tag) > 0 else None
示例5: parentNode
# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import wrap [as 别名]
def parentNode(self):
return Node.wrap(self.doc, self.tag.parent) if self.tag.parent else None
示例6: childNodes
# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import wrap [as 别名]
def childNodes(self):
from NodeList import NodeList
#return NodeList(self.doc, self.tag.contents)
return Node.wrap(self.doc, NodeList(self.doc, self.tag.contents))