Python xml.sax.handler 模块,ContentHandler() 实例源码

我们从Python开源项目中,提取了以下15个代码示例,用于说明如何使用xml.sax.handler.ContentHandler()

项目:gprime    作者:GenealogyCollective    | 项目源码 | 文件源码
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
项目:gprime    作者:GenealogyCollective    | 项目源码 | 文件源码
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
项目:ome-model    作者:ome    | 项目源码 | 文件源码
def __init__(self):
        handler.ContentHandler.__init__(self)
        self.stack = []
        self.root = None
        self.inElement = 0
        self.inComplexType = 0
        self.inNonanonymousComplexType = 0
        self.inSequence = 0
        self.inChoice = 1
        self.inAttribute = 0
        self.inAttributeGroup = 0
        self.inSimpleType = 0
        self.inUnionType = 0
        self.inAppInfo = 0
        # The last attribute we processed.
        self.lastAttribute = None
        # Simple types that exist in the global context and may be used to
        # qualify the type of many elements and/or attributes.
        self.topLevelSimpleTypes = list()
        # The current choices we have available indexed by their level in the
        # tree.
        self.currentChoices = dict()
##        self.dbgcount = 1
##        self.dbgnames = []
项目:gprime    作者:GenealogyCollective    | 项目源码 | 文件源码
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
项目:gprime    作者:GenealogyCollective    | 项目源码 | 文件源码
def __init__(self, paper_list):
        handler.ContentHandler.__init__(self)
        self.paper_list = paper_list
        self.locator = None
项目:gprime    作者:GenealogyCollective    | 项目源码 | 文件源码
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
项目:open_landscape    作者:furti    | 项目源码 | 文件源码
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
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def __init__(self, out=sys.stdout):
        handler.ContentHandler.__init__(self)
        self._out = codecs.getwriter('utf-8')(out)

        self._text = ""
        self._parent = None
        self._list_started = False
        self._title = None
        self._link = None
        self._descr = ""

    # ContentHandler methods
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def __init__(self, out=sys.stdout):
        handler.ContentHandler.__init__(self)
        self._out = out

    # ContentHandler methods
项目:cve-analysis    作者:joshbressers    | 项目源码 | 文件源码
def __init__(self):
        handler.ContentHandler.__init__(self)

        self.CVE = {}
        self.refs = []
        self.currentElement = None

    # ContentHandler methods
项目:cve-analysis    作者:joshbressers    | 项目源码 | 文件源码
def __init__(self):
        handler.ContentHandler.__init__(self)

        self.CVE = {}
        self.refs = []
        self.currentElement = None

    # ContentHandler methods
项目:OpyenXes    作者:opyenxes    | 项目源码 | 文件源码
def endElement(self, local_name):
            """ Overrides endElement in class ContentHandler

            :param local_name: The name of the element type, just as with the
              startElement event
            :type local_name: str
            """
            tag_name = local_name

            if tag_name.lower() in ["string", "date", "int", "float", "boolean", "id"]:
                self.__currentAttribute = None
项目:OpyenXes    作者:opyenxes    | 项目源码 | 文件源码
def ignorableWhitespace(self, whitespace):
            """ Overrides ignorableWhitespace in class ContentHandler

            :param whitespace: The whitespace characters.
            :type whitespace: str
            """
            self.__buffer.append(whitespace)
项目:OpyenXes    作者:opyenxes    | 项目源码 | 文件源码
def characters(self, content):
            """ Overrides characters in class ContentHandler

            :param content: The characters.
            :type content: str
            """
            self.__buffer.append(content)
项目:Zeuz_Python_Node    作者:AutomationSolutionz    | 项目源码 | 文件源码
def check_wellformed(filename):
    sModuleInfo = inspect.stack()[0][3] + " : " + inspect.getmoduleinfo(__file__).name
    #filename = "/home/asci/AssetScience/recell_dse-in-test/Launcher/resource/configurations/desktop-fail-codes.xml"
    try:
        parser = make_parser( )
        parser.setContentHandler(ContentHandler( ))
        parser.parse(filename)
        CommonUtil.ExecLog(sModuleInfo, "%s is well-formed. %s" % filename, 1)

    except Exception:
        errMsg = "%s is NOT well-formed! " % filename
        return CommonUtil.Exception_Handler(sys.exc_info(), None, errMsg)