本文整理汇总了Python中xml.sax.saxutils.XMLFilterBase.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python XMLFilterBase.__init__方法的具体用法?Python XMLFilterBase.__init__怎么用?Python XMLFilterBase.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml.sax.saxutils.XMLFilterBase
的用法示例。
在下文中一共展示了XMLFilterBase.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(
self, upstream, downstream, tag_name,
layers_blacklist=None, layers_whitelist=None):
XMLFilterBase.__init__(self, upstream)
self._downstream = downstream
self._accumulator = []
assert layers_blacklist is not None or layers_whitelist is not None, \
"either layers_blacklist OR layers_whitelist must be set"
assert not (
layers_blacklist is not None and
layers_whitelist is not None), \
"only either layers_blacklist OR layers_whitelist can be set"
if layers_blacklist is not None:
layers_blacklist = [layer.lower() for layer in layers_blacklist]
if layers_whitelist is not None:
layers_whitelist = [layer.lower() for layer in layers_whitelist]
self.layers_blacklist = layers_blacklist
self.layers_whitelist = layers_whitelist
self.layers_path = []
self.in_name = False
self.tag_name = tag_name
self.level = 0
示例2: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, file):
XMLFilterBase.__init__(self)
self.generator = XMLGenerator(file, 'UTF-8')
self.generator.startPrefixMapping(u'', u'http://www.eucalyptus.com/ns/reporting/export/2012-08-24/')
self.replyData = StringIO()
self.replyGenerator = XMLGenerator( self.replyData, 'UTF-8' )
self.switchTarget( self.replyGenerator )
示例3: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__ (self, upstream, SkipEvents = False):
self.EventCounters = {}
self.TotalEventCount = 0
self.SkipEvents = SkipEvents
self.NewEventType = True
self.AccumulatingEventContent = False
self.CurrentEventContent = ''
self.StreamCopyEnabled = False
# This buffer will be used to compile a copy of the incoming EDXML
# stream that has all event data filtered out. We use this stripped
# copy to do RelaxNG validation, as Python has no incremental XML
# validator like for instance PHP does.
self.DefinitionsXMLStringIO = StringIO()
# And this is the XMLGenerator instance that we will use
# to fill the buffer.
self.DefinitionsXMLGenerator = XMLGenerator(self.DefinitionsXMLStringIO, 'utf-8')
"""EDXMLDefinitions instance"""
self.Definitions = EDXMLDefinitions()
# We want the EDXMLDefinitions instance to call our
# error handler, so anyone who wishes to extend the EDXMLParser
# class can reimplement it to handle all generated errors.
self.Definitions.Error = self.Error
XMLFilterBase.__init__(self, upstream)
EDXMLBase.__init__(self)
示例4: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, upstream, downstream, text_filter, manualOverride = False):
XMLFilterBase.__init__(self, upstream)
self._downstream = downstream
self._accumulator = []
self.text_filter = text_filter
self.should_filter = False
self.manualOverride = manualOverride # Set this to True if you want text_filter never to run
return
示例5: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, upstream, downstream):
XMLFilterBase.__init__(self, upstream)
self._downstream = downstream
self._accumulator = []
#self.padding_level = -1 # for pretty debug printing
self.current_element = None # what element are we inside?
self.passthrough = False # allow current element through the filter?
# Placeholders for the attributes for the builder and shape elements...
self.builder_info = None
self.shape_info = None
示例6: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, upstream, downstream, filename,chunksize = 100):
XMLFilterBase.__init__(self, upstream)
self.handlers = []
self.pushHandler(downstream)
self.filename = filename
self.chunksize = int(chunksize)
self.rec_count = 0
self.chunknames = []
self.tempdir = ''
self.verbose = False
示例7: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, *args):
XMLFilterBase.__init__(self, *args)
self._accumulator = []
return
示例8: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, parser=None, downstream=None, iso639=None):
XMLFilterBase.__init__(self, parser)
self.__downstream = downstream
self.__iso639 = iso639
self.__is_language = False
示例9: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, rules):
XMLFilterBase.__init__(self)
self.rules = rules
self.prefixes = {None:None}
self.prefixesStack = {}
self.contexts = [FilterContext()]
示例10: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, upstream, downstream):
XMLFilterBase.__init__(self, upstream)
self.__downstream = downstream
self.__isUni = False
self.__uniText = u""
示例11: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, upstream, downstream, stereo, kind):
XMLFilterBase.__init__(self, upstream)
self._downstream = downstream
self._stereotype = stereo
self._kind = kind
return
示例12: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, parent):
self.in_universe = -1
self.recording = None
self.cell = None
self.cell_active = None
XMLFilterBase.__init__(self, parent)
示例13: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, upstream, downstream, limit=200):
XMLFilterBase.__init__(self, upstream)
self._count = 0
self._limit = limit
self._downstream = downstream
示例14: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, upstream, downstream):
XMLFilterBase.__init__(self, upstream)
self.__downstream = downstream
self.__isOrth = False
self.__isBase = False
self.__orthText = u""
示例15: __init__
# 需要导入模块: from xml.sax.saxutils import XMLFilterBase [as 别名]
# 或者: from xml.sax.saxutils.XMLFilterBase import __init__ [as 别名]
def __init__(self, upstream, downstream):
XMLFilterBase.__init__(self, upstream)
self._downstream=downstream
self._accumulator=[]