示例#1
0
    def __init__(self, uri, encoding="utf-8", mapToBE={}, mapFromBE=None):
        """Initialises a new XML repo parser. mapToBE should be a dictionary mapping the source
        XML element tags to BE element names if necessary. Current BE bug
        fields:

        bug: XMLIssue
        """
        if mapFromBE is None: mapFromBE={v:k for k, v in mapToBE.iteritems()}
        ParserBase.__init__(self, uri)
        self.__mapToBE=mapToBE
        self.__mapFromBE=mapFromBE
        self.source=None
        self.bugs={}
        # Save creating an XMLSchema per instance by poking this into the derived class as a static variable
        if self.xml_schema is None:
            self.__class__.xml_schema=etree.XMLSchema(file=self._schemapath())