本文整理汇总了Python中xml.dom.expatbuilder.parse方法的典型用法代码示例。如果您正苦于以下问题:Python expatbuilder.parse方法的具体用法?Python expatbuilder.parse怎么用?Python expatbuilder.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml.dom.expatbuilder
的用法示例。
在下文中一共展示了expatbuilder.parse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from xml.dom import expatbuilder [as 别名]
# 或者: from xml.dom.expatbuilder import parse [as 别名]
def parse(file, parser=None, bufsize=None):
"""Parse a file into a DOM by filename or file object."""
if parser is None and not bufsize:
from xml.dom import expatbuilder
return expatbuilder.parse(file)
else:
from xml.dom import pulldom
return _do_pulldom_parse(pulldom.parse, (file,),
{'parser': parser, 'bufsize': bufsize})
示例2: parse
# 需要导入模块: from xml.dom import expatbuilder [as 别名]
# 或者: from xml.dom.expatbuilder import parse [as 别名]
def parse(file, parser=None, bufsize=None):
"""Parse a file into a DOM by filename or file object."""
import sys
if parser is None and bufsize is None and sys.platform[:4] != "java":
try:
from xml.dom import expatbuilder
return expatbuilder.parse(file)
except ImportError:
pass
from xml.dom import pulldom
return _do_pulldom_parse(pulldom.parse, (file,),
{'parser': parser, 'bufsize': bufsize})
示例3: parse
# 需要导入模块: from xml.dom import expatbuilder [as 别名]
# 或者: from xml.dom.expatbuilder import parse [as 别名]
def parse(file, parser=None, bufsize=None):
"""Parse a file into a DOM by filename or file object."""
if parser is None and not bufsize and sys.platform[:4] != "java":
from xml.dom import expatbuilder
return expatbuilder.parse(file)
else:
from xml.dom import pulldom
return _do_pulldom_parse(pulldom.parse, (file,),
{'parser': parser, 'bufsize': bufsize})