当前位置: 首页>>代码示例>>Python>>正文


Python handler.ContentHandler方法代码示例

本文整理汇总了Python中xml.sax.handler.ContentHandler方法的典型用法代码示例。如果您正苦于以下问题:Python handler.ContentHandler方法的具体用法?Python handler.ContentHandler怎么用?Python handler.ContentHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xml.sax.handler的用法示例。


在下文中一共展示了handler.ContentHandler方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from xml.sax import handler [as 别名]
# 或者: from xml.sax.handler import ContentHandler [as 别名]
def __init__(self, sheetlist):
        """
        Create a SheetParser class that populates the passed StyleSheetList
        class.

        sheetlist - :class:`StyleSheetList` instance to be loaded from the file.
        """
        handler.ContentHandler.__init__(self)
        self.sheetlist = sheetlist
        self.f = None
        self.p = None
        self.s = None
        self.t = None
        self.columns_widths = []
        self.sheet_name = None
        self.style_name = None 
开发者ID:GenealogyCollective,项目名称:gprime,代码行数:18,代码来源:stylesheet.py

示例2: __init__

# 需要导入模块: from xml.sax import handler [as 别名]
# 或者: from xml.sax.handler import ContentHandler [as 别名]
def __init__(self, booklist, dbase):
        """
        Create a BookParser class that populates the passed booklist.

        booklist:   BookList to be loaded from the file.
        """
        handler.ContentHandler.__init__(self)
        self.dbase = dbase
        self.booklist = booklist
        self.book = None
        self.item = None
        self.option = None
        self.an_opt_name = None
        self.an_opt_value = None
        self.style = None
        self.bname = None
        self.iname = None
        self.dbname = None
        self.b_p_name = None
        self.b_p_orient = None
        self.b_p_metric = None
        self.b_p_size = None
        self.b_p_margins = None
        self.b_p_format = None
        self.b_p_output = None 
开发者ID:GenealogyCollective,项目名称:gprime,代码行数:27,代码来源:_book.py

示例3: __init__

# 需要导入模块: from xml.sax import handler [as 别名]
# 或者: from xml.sax.handler import ContentHandler [as 别名]
def __init__(self, paper_list):
        handler.ContentHandler.__init__(self)
        self.paper_list = paper_list
        self.locator = None 
开发者ID:GenealogyCollective,项目名称:gprime,代码行数:6,代码来源:_paper.py

示例4: __init__

# 需要导入模块: from xml.sax import handler [as 别名]
# 或者: from xml.sax.handler import ContentHandler [as 别名]
def __init__(self, collection):
        """
        Create a OptionParser class that populates the passed collection.

        collection:   OptionListCollection to be loaded from the file.
        """
        handler.ContentHandler.__init__(self)
        self.collection = collection

        self.mname = None
        self.option_list = None
        self.oname = None
        self.odict = None
        self.an_o = None
        self.list_class = OptionList 
开发者ID:GenealogyCollective,项目名称:gprime,代码行数:17,代码来源:_options.py

示例5: __init__

# 需要导入模块: from xml.sax import handler [as 别名]
# 或者: from xml.sax.handler import ContentHandler [as 别名]
def __init__(self, gfilter_list):
        handler.ContentHandler.__init__(self)
        self.gfilter_list = gfilter_list
        self.f = None
        self.r = None
        self.a = []
        self.cname = None
        self.namespace = 'Person'
        self.use_regex = False 
开发者ID:GenealogyCollective,项目名称:gprime,代码行数:11,代码来源:_filterparser.py

示例6: __init__

# 需要导入模块: from xml.sax import handler [as 别名]
# 或者: from xml.sax.handler import ContentHandler [as 别名]
def __init__(self, result):
        """
        :param result: Append results to this result set.
        :type result: overpy.Result
        """
        handler.ContentHandler.__init__(self)
        self._result = result
        self._curr = {}
        #: Current relation member object
        self.cur_relation_member = None 
开发者ID:DinoTools,项目名称:python-overpy,代码行数:12,代码来源:__init__.py

示例7: __init__

# 需要导入模块: from xml.sax import handler [as 别名]
# 或者: from xml.sax.handler import ContentHandler [as 别名]
def __init__(self, entry_cb=None):
        # Define the callbacks
        self.entry_cb = entry_cb
    
    # ContentHandler methods 
开发者ID:blackye,项目名称:luscan-devel,代码行数:7,代码来源:export.py

示例8: __init__

# 需要导入模块: from xml.sax import handler [as 别名]
# 或者: from xml.sax.handler import ContentHandler [as 别名]
def __init__(self):
        handler.ContentHandler.__init__(self)
        self.projects = set() 
开发者ID:ourresearch,项目名称:depsy,代码行数:5,代码来源:get_pypi_packages_metadata.py

示例9: __init__

# 需要导入模块: from xml.sax import handler [as 别名]
# 或者: from xml.sax.handler import ContentHandler [as 别名]
def __init__(self, pref=None):
        handler.ContentHandler.__init__(self)
        self.key = None
        self.value = None
        self.pref = pref 
开发者ID:sk1project,项目名称:uniconvertor,代码行数:7,代码来源:config.py

示例10: load_stream

# 需要导入模块: from xml.sax import handler [as 别名]
# 或者: from xml.sax.handler import ContentHandler [as 别名]
def load_stream(stream):
  """Loads an SVG image from a stream (can be a string or a file object)."""

  from xml.sax import handler, make_parser
  from xml.sax.handler import feature_namespaces, feature_external_ges, feature_external_pes

  class ContentHandler(handler.ContentHandler):
    def __init__(self):
      self.stack = []
      self.output = None
      self.all_whitespace = re.compile("^\s*$")

    def startElement(self, name, attr):
      s = SVG(name)
      s.attr = dict(attr.items())
      if len(self.stack) > 0:
        last = self.stack[-1]
        last.sub.append(s)
      self.stack.append(s)

    def characters(self, ch):
      if not isinstance(ch, basestring) or self.all_whitespace.match(ch) == None:
        if len(self.stack) > 0:
          last = self.stack[-1]
          if len(last.sub) > 0 and isinstance(last.sub[-1], basestring):
            last.sub[-1] = last.sub[-1] + "\n" + ch
          else:
            last.sub.append(ch)

    def endElement(self, name):
      if len(self.stack) > 0:
        last = self.stack[-1]
        if isinstance(last, SVG) and last.t == "style" and "type" in last.attr and last.attr["type"] == "text/css" and len(last.sub) == 1 and isinstance(last.sub[0], basestring):
          last.sub[0] = "<![CDATA[\n" + last.sub[0] + "]]>"

      self.output = self.stack.pop()

  ch = ContentHandler()
  parser = make_parser()
  parser.setContentHandler(ch)
  parser.setFeature(feature_namespaces, 0)
  parser.setFeature(feature_external_ges, 0)
  parser.parse(stream)
  return ch.output

###################################################################### 
开发者ID:mortcanty,项目名称:earthengine,代码行数:48,代码来源:svgfig.py


注:本文中的xml.sax.handler.ContentHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。